Updated some NUGET packages today and also installed Itext7 on a dev machine. VS 2022. Installed Itext7 package.
When I rebuilt the project it threw 38 errors, most of them 'font' is ambiguous in the namespace 'System.Drawing' code bc30560. Font & systemcolors were the two main errors. I removed the Itext7 packages .
I had them all fully named:(example Below)
Me.TBtotalCk.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
and yet it's telling me "System.Drawing.Font" is ambiguous. Even if I use an Imports statement. System.Drawing works but System.Drawing.Font throws the same error, ambiguous.
Any ideas or help is greatly appreciated
I have run into this from time to time. This is counter-intuitive but try this.
Remove all of the qualifiers:
Me.TBtotalCk.Font = New Font("Microsoft Sans Serif", 10.0!, FontStyle.Regular, GraphicsUnit.Point, CType(0, Byte))
Check for any syntax errors. If found hover and click on the "suggested fix" link. This should tell you what is confusing the system.
Hope this helps.
Related
I'm trying to load an excel file to datagridview however I keep getting the error "could not find installable ISAM." I tried what other posts said about changing where I put my single quotes but I still keep getting that error. This is what I have right now.
conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.16.0;Data Source='C:\Users\test.xlsx';Extended Properties='Excel 16.0;';")
Thanks for the help in advance!
You need install Microsoft Access Runtime
https://support.microsoft.com/en-us/office/download-and-install-microsoft-365-access-runtime-185c5a32-8ba9-491e-ac76-91cbe3ea09c9
And make sure your project is match de architecture of your ACE Runtime.
I'll just recommend to use OLEDB.12.0 as this and remove excess of '
OleDbConnection conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\test.xlsx;Extended Properties='Excel 8.0;';")
In our VB6 application, we use ADODB.Recordsets and make use of the Data provider for MSDataShape to create a relational recordset with SHAPE commands.
In the latest Windows 10 Feature (1809) our code breaks with the following error: -
"-2147217900 Length of NEW column SiteCode cannot be zero"
from the following macro in excel (where MDAC is a reference)
Public Sub TestRun()
Dim rsStockCheck As Recordset
On Error GoTo ErrorHandler
' set up shape recordset
Set rsStockCheck = New Recordset
With rsStockCheck
.ActiveConnection = "Provider=MSDataShape;Data Provider=None"
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
.Open "SHAPE APPEND new adInteger as StockCheckID, new adInteger as SiteID, new adVarChar(8) as SiteCode"
.ActiveConnection = Nothing
End With
ErrorHandler:
If Err.Number <> 0 Then
MsgBox "failed: " & Err.Description
Else
MsgBox "works ok"
End If
Set rsStockCheck = Nothing
End Sub
This might be related to this being eventually removed as mentioned here.
... but I'm not sure if it is just yet. Has anyone come across this problem?
EDIT: I've tried this on an upgraded machine and Fresh install of 1809 and it's broken on both.
EDIT 2: List of other forum threads regarding this issue:
Microsoft "Data Platform Development > ADO.NET DataSet" forum
(Reported by someone else, and it affects Server 2019 too)
Microsoft "Windows Desktop Development > General Windows Desktop Development Issues" forum
Microsoft "Windows 10 IT Pro > Windows 10 Insider Preview Builds" forum
Microsoft " Windows Server Windows > Server Insiders" forum
EDIT 3: Latest Nov 13 update for Windows 1809, still does not fix this issue. For a workaround however, read this.
Same problem with me ... However, I have found the workaround for this issue ...
Replacing adVarChar(##) with adLongVarChar does the job for me ...
Please reply, if anyone has another solution
Edited:
This workaround is not applicable to queries like
SHAPE APPEND NEW adLongVarChar As INVNO, NEW adLongVarChar As iCP,
((SHAPE APPEND NEW aadLongVarChar As INVNO,NEW adLongVarCharAs iCP,NEW adLongVarChar As F1,NEW adLongVarChar As F2,NEW adLongVarChar As F3)
AS Trans RELATE INVNO TO INVNO,iCP TO iCP)
Finding a solution to get out of this issue
EDIT : This error has been fixed in recent windows update (Version: 1809 OS Build : 17763.475). Everything working fine for me.
I've found a solution that works in all scenarios.
Instead of adVarChar(size) use the OLEDB datatype DBTYPE_BSTR. For example, instead:
SHAPE APPEND NEW adVarChar(8) As INVNO, NEW adVarChar(8) As iCP,
((SHAPE APPEND NEW adVarChar(8) As INVNO,NEW adVarChar(8) As iCP...)
AS Trans RELATE INVNO TO INVNO,iCP TO iCP)
write:
SHAPE APPEND NEW DBTYPE_BSTR As INVNO, NEW DBTYPE_BSTR As iCP,
((SHAPE APPEND NEW DBTYPE_BSTR As INVNO,NEW DBTYPE_BSTR As iCP...)
AS Trans RELATE INVNO TO INVNO,iCP TO iCP)
Notes:
DBTYPE_BSTR doesn't accept the size of the field, so it's not exactly a varchar
I had to use DBTYPE_BSTR keyword, using adBSTR produced an error message in the command (?!).
While this doesn't directly answer your question, MSDataShape is obsolete and being removed.
Suggest that you port your queries to FROM XML and change your client to parse the response using SAX or a pull parser.
It seems changing SHAPE APPEND new adVarChar(8) as SiteCode to
SHAPE APPEND new adLongVarChar as SiteCode causes that SiteCode can not be a sort key.
However it seems SiteCode_Calc of SHAPE APPEND new adLongVarChar as SiteCode,calc(Left$(SiteCode,8)) as SiteCode_Calc can be a sort key.
However it seems MoveNext/EOF won't work correctly when the value of SiteCode_Calc is gotten.
As #Shrikant has mentioned, this was fixed in a recent windows update (Version: 1809 OS Build : 17763.475) and also confirm it's fixed in 1903.
I try to get some text of an image by using OCR. I have to initialize a Tesseract for that and this was my try:
Imports Emgu.CV
Imports Emgu.Util
Imports Emgu.CV.Structure
Imports Emgu.CV.OCR
Imports Emgu.CV.UI
Imports Emgu.CV.CvEnum
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim lolProcess() As Process = Process.GetProcessesByName("lolClient")
Dim snap As New CScreenFromWindow
Dim OCRz As Tesseract = New Tesseract("tessdata", "eng", Tesseract.OcrEngineMode.OEM_TESSERACT_ONLY)
OCRz.Recognize(New Image(Of Bgr, Byte)(snap.GetFromAll(lolProcess(0))))
MsgBox(OCRz.GetText())
End Sub
End Class
When launching my code I get the following error:
"System.TypeInitializationException"
"Emgu.CV.OCR.Tesseract" caused an exception
I have googled a lot, but can't find my mistake. I've downloaded EMGU from this link and installed the .exe. Then I added every .dll from the bin-directory as a reference to my project. I also added all opencv_XXXXX.dll-files to my project. Then I also added the tessdata-directory to my project. I've marked all the added dlls as "Always copy to output-directory".
There are opencv_XXXXXX.dll-files for x86 and x64. I tried to swap them to x64 but those also don't work.
Does anybody see my mistake?
This are the error-messages and stack-traces:
System.ArgumentException: Unable to create ocr model using Path tessdata and language eng.
bei Emgu.CV.OCR.Tesseract.Init(String dataPath, String language, OcrEngineMode mode) in c:\Emgu\emgucv-windows-universal-gpu 2.4.9.1847\Emgu.CV.OCR\Tesseract.cs:Zeile 226.
bei Emgu.CV.OCR.Tesseract..ctor(String dataPath, String language, OcrEngineMode mode) in c:\Emgu\emgucv-windows-universal-gpu 2.4.9.1847\Emgu.CV.OCR\Tesseract.cs:Zeile 118.
bei Dodgemaster.Form1.Button1_Click(Object sender, EventArgs e) in X:\Dokumente\Visual Studio 2013\Projects\Dodgemaster\Dodgemaster\Form1.vb:Zeile 16.
A Hello World test-programm works fine. So it can't be something wrong with the references, right?
When you have referenced the .dlls try changing the "copy to output directory" value in the properties to "Copy always"
Also try running it on 3.5 .NET framework.
Failing that try following this:
https://www.youtube.com/watch?v=RqvvXJXuRYY&list=UUxAnMtjN08ryThpgYTBmILg
Really helpful tutorial.
After several reinstalls of different emgu-installs I finally found one, that works. It's an older version, not the current one, but it is for x64. Having in mind that EVERY needed file/dll HAS TO be for x64 and working excactly as in the video, I finally got it work.
Seemed to be an x86/x64 issue.
You have to change the DPath from "tessdata" to "".
Dim OCRz As Tesseract = New Tesseract("", "eng", OcrEngineMode.TesseractOnly)
That's how I got mine to work.(libemgucv-windows-universal-cuda-3.0.0.2158)
Sort of a newbie here - retired VB programmer, so I am a newbie in VB.Net.
I have been developing a program, and in testing functions, I have been reading text from a file. I am ready to go to my next step of getting my data from an Excel file rather than a text file. So I add the following line:
"Imports Microsoft.Office.Interop.Excel"
And now previously existing code has broken. The last line in this group now errors
"Reference to a non-shared member required an object reference":
Using G = Graphics.FromImage(Bmp)
'Paint the canvas
G.Clear(Color.Black)
G.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBilinear
G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
G.TextRenderingHint = Drawing.Text.TextRenderingHint.SingleBitPerPixel
And
Dim F As New Font(Font_name, Font_Size)
now gives an error "'New' cannot be used on an interface"
And
Dim allFonts As New Drawing.Text.InstalledFontCollection
errors with "'Drawing.Text.InstalledFontCollection' is not defined"
AND... Most mysteriously,
If FontDialog1.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
errors with "'Forms' is not a member of 'Microsoft.Office.Interop.Excel.Windows'"
And all I did was add "Imports Microsoft.Office.Interop.Excel" to the top of my form. The program was running with no errors before then.
Any pointers to what the heck is going on would be appreciated.
Thanks
You also need to add a Reference to Microsoft.Office.Interop.Excel as well as using an Imports statement
I wonder if its possible to use a custom font for my form labels without installing it on the users machine? I would like to display a text using a font I have rights to, but its not installed on the potencial user machine.
Are there any solutions for this?
Here is the extract (using PrivateFontCollection):
Dim pfc As New PrivateFontCollection()
pfc.AddFontFile("C:\Path To\PALETX3.ttf")
label1.Font = New Font(pfc.Families(0), 16, FontStyle.Regular)
Converted from here: Load And Use Custom Font Without Installing It.
Also check this: Embedding/deploying custom font in .NET app
Add this code in Top of your Code
Imports System.Drawing.Text
Add this code on Form1_Load() to change the Lablel1.Font
Dim customfont As PrivateFontCollection = New PrivateFontCollection
customfont.AddFontFile("C:\maven.ttf")
Label1.Font = New Font(customfont.Families(0), 10)
Tested on Visual Basic 2010 Enterprises Edition