|
One of the objects that you are concatenating has 'nothing' in it. Have you looked at
each object reference at index(i) to see what it contains? As a test you could concatenate
each object individually to see what object is causing the problem.
Dim ins2 as string = "INSERT...."
ins2 += entry_no
ins2 += "', '"
ins2 += srno(i)
...
|
|
|
|
|
|
Once you find which item is causing the problem, you can put in a check. I use a function such as NumNull(exp(i)) or StrNull(item_name(i) . Here are the functions:
Function NumNull(Number As Object) As Object
If Number IsNot DBNull.Value Then
NumNull = Number
Else
NumNull = 0
End If
End Function
Function StrNull(Str As Object) As Object
If Str IsNot DBNull.Value Then
StrNull = Str
Else
StrNull = ""
End If
End Function
|
|
|
|
|
Hi All.
I have a User form in Excell VBA. It have many control such as textbox, check, combobox.....
And I want to use tab to change from this control to another control in the form.
I have done
-set Tabstop of all the control to true
- Set tabindex for all control in the right order.
But I can't swich between control. Please help
|
|
|
|
|
|
Hello !
I have a project in vb.net 2017.
I want to change the project folder's name.
Currently the project has these folders :
c:\
|
Myapp (folder )
|
Myapp (folder )
MyProject.sln ( solution file )
I have changed both Myapp folders name to Myapp1 , but after that the solution is open empty.
What else should i change in order to have my project running again ?
Thank you !
|
|
|
|
|
Open the solution's .sln file and update the path there.
|
|
|
|
|
|
You need to "remove" the project with the renamed folder.
Then, add it BACK again using the "new location" (i.e. renamed folder).
In general, "remove" items before "mucking" with the solution's / projects' file system; then add things back in.
Beware of creating solutions that span multiple "high-level" folders; you won't know what is being referenced by what (i.e. projects being "shared" across solutions).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Well after several hours I seem to have resolve this problem although I am still
not confident in my understanding of the issue. Without getting into all of the hairy
details the basic problem is related to initializing the control with Visible = False
and the fact that the control does not have or get a Parent during initialization. I
do not know why this is an issue because I cannot see the underlying vb code. By waiting
and setting Visible = False during Load() seems to have fixed the problem.
I am working on a custom tooltip control and have a particular problem with my control stealing
focus from the form.
Below are my creation parameters that are what I've used in VS C++ to do the same thing.
These are meant to create a WS_EX_TOOLWINDOW which displays above controls and the Form.
Below that is the stack trace that shows the issue where WmSetFocus() is being called
through my call to CreateGraphics(). I don't know what I can do to prevent this call
unless there is a style I can return in CreateParams() to prevent the call.
Can someone help?
Note I have removed some of the stack trace detail to try to reduce size of this message.
I have left what I think is relevant. If you think you need the rest let me know and I will
post it all.
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Const WS_EX_TOPMOST As Integer = &H8
Const WS_EX_NOACTIVATE As Integer = &H8000000
Const WS_EX_TOOLWINDOW As Integer = &H80
Const WS_EX_CONTROLPARENT As Integer = &H10000
Const WS_POPUP As Integer = &H80000000
Const WS_CHILD As Integer = &H40000000
Const WS_VISIBLE As Integer = &H10000000
Const WS_DISABLED As Integer = &H8000000L
Dim cp As CreateParams = MyBase.CreateParams
Debug.WriteLine(String.Format("CreateParams1():EX({0:X}),WS({1:X})", cp.ExStyle, cp.Style))
' Set topmost and prevents activation.
cp.ExStyle = cp.ExStyle Or (WS_EX_NOACTIVATE Or WS_EX_TOOLWINDOW Or WS_EX_TOPMOST)
cp.ExStyle = cp.ExStyle And Not WS_EX_CONTROLPARENT
' WS_POPUP makes control display above other controls including form.
' MSDN says you cannot combine WS_CHILD and WS_POPUP
cp.Style = cp.Style Or (WS_POPUP Or WS_DISABLED)
cp.Style = cp.Style And Not (WS_CHILD Or WS_VISIBLE)
Debug.WriteLine(String.Format("CreateParams2():EX({0:X}),WS({1:X})", cp.ExStyle, cp.Style))
Return cp
End Get
End Property
Stack
MyControls.dll!MyControls.TooltipControl.got(Object sender = {MyControls.TooltipControl}, System.EventArgs action = {System.EventArgs}) Line 968 Basic
System.Windows.Forms.dll!System.Windows.Forms.Control.OnGotFocus(System.EventArgs e) + 0xb8 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmSetFocus(ref System.Windows.Forms.Message m) + 0x143 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x5cd bytes
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WmSetFocus(ref System.Windows.Forms.Message m) + 0x19c bytes
????????? Problem SetFocus()
System.Windows.Forms.dll!System.Windows.Forms.UserControl.WmSetFocus(ref System.Windows.Forms.Message m) + 0xdf bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateChildZOrder(System.Windows.Forms.Control ctl) + 0x2cf bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WmCreate(ref System.Windows.Forms.Message m) + 0x7d bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x4a6 bytes
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 0x00000001, System.IntPtr wparam, System.IntPtr lparam) + 0xad bytes
[Native to Managed Transition]
[Managed to Native Transition]
???????????? CreateParams
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.CreateHandle(System.Windows.Forms.CreateParams cp) + 0x3e7 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateHandle() + 0x24a bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.Handle.get() + 0x65 bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateGraphicsInternal() + 0xa bytes
System.Windows.Forms.dll!System.Windows.Forms.Control.CreateGraphics() + 0x99 bytes
MyControls.dll!MyControls.TooltipControl.MeasureControlInfoText(Boolean bAll = False) Line 1252 + 0xd bytes Basic
-- modified 30-Mar-18 20:15pm.
|
|
|
|
|
If the "custom control" is "stealing" focus at certain times, why don't you simply "reset" the focus instead of fighting a control you claim to have no "control" over?
I typically set focus (if I need to) after the ui is "ready for interaction"; which is generally at the end of the "loaded event" (or "activated" in special cases).
If a call to "something" causes focus to be "stolen", then "save" a reference to the control currently having focus, make the call, then re-focus.
Those are the only scenarios.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hello Everyone!
I am developing a simple stock management software for my final year college project.
I am trying to fire following queries:
"UPDATE item_stock SET qnt = (qnt + '" & qty & "'), amount = (amount + '" & mrp * qty & "') WHERE batch = '" & batch & "'"
<pre>"UPDATE item_stock SET qnt = (qnt - '" & qty & "'), amount = (amount - '" & mrp * qty & "') WHERE batch = '" & batch & "'"
The Subtraction is working fine but I cannot see affect of the addition. Any help?
|
|
|
|
|
"Final" year? How many years did you have this teacher?
Your numbers aren't; they are text. If you want to calculate, use numbers. Also, don't concatenate strings like that, I would wipe your database on my first test-run of your application.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
hey
i'm working on a notepad project
and i want to open .txt files with my app
it worked
BUT
when i open a file ,modify it and save... save only NOT save as
it opens save as file
i want to modify the opened file
here is the code i'm using
Shared Sub DoubleClickFile(Textbox As TextBox)
If System.Environment.GetCommandLineArgs().Length > 1 Then
Dim i As Integer
For i = 1 To System.Environment.GetCommandLineArgs().Length - 1
Dim zReader As StreamReader
zReader = New StreamReader(System.Environment.GetCommandLineArgs(i), True)
Textbox.Text = zReader.ReadToEnd
Next
Else
End If
End Sub
|
|
|
|
|
Where is the code that saves the modified file?
|
|
|
|
|
Backgroud: I'm trying to automate the printing of PDF files.
I found that by invoking
acrord32.exe /N /T pdfFile printerName on the command line you can print PDFs silently. Great.
I'm trying to automate this in VB via
Dim p As Process = New Process()
Dim pi As ProcessStartInfo = New ProcessStartInfo()
Dim command As String = Chr(34) & "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" & Chr(34) & " /N /T "
Try
pi.Arguments = String.Format("{0} {1} {2} {3}{4}{5}", " /C ", command, sFilename, Chr(34), sPrinter, Chr(34))
pi.UseShellExecute = False
pi.RedirectStandardError = True
pi.RedirectStandardOutput = True
pi.CreateNoWindow = True
pi.WindowStyle = ProcessWindowStyle.Normal
pi.FileName = "cmd.exe"
p.StartInfo = pi
p.Start()
Do Until p.HasExited : Loop
outp = p.StandardOutput.ReadToEnd
Debug.Print(outp)
outp = p.StandardError.ReadToEnd
Debug.Print(outp)
Catch ex As Exception
Debug.Print(ex.Message)
End Try
The error message I get from StdErr is Quote: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
I've tried putting quotes around the command string, but it just doesn't work.
Turning to the community for guidance.
|
|
|
|
|
You have to separate the command line options from the command you're trying to execute.
For your "filename", you've got:
"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe" /N /T
That doesn't work.
Your filename and arguments must be specified separately:
Dim command As String = """C:\Program Files (x86)\Adobe\Reader 11.0\Reader\acrord32.exe"""
Dim arguments As String = String.Format("/n /t ""{0}"" ""{1}"" ""{2}"" ""{3}""", pdfFilePath, printerName, driverName, portName)
Dim process As New Process
Dim pi As New ProcessStartInfo
pi.Filename = command
pi.Arguments = arguments
process.StartInfo = pi
process.Start
Yes, the double quotes are there for a reason. It's shorter to type "" than it is to type Chr$(34) & .
|
|
|
|
|
Your suggestion worked perfectly. I was over-thinking the problem. I was trying to run cmd.exe and pass the acrord32.exe as a parameter.
Your solution of running acrord32.exe directly worked.
Thank you.
|
|
|
|
|
Hello,
I am stumped by this.
csng("1422.843197465627") returns
1422.84314
and NOT 1422.8432 or even 1422.84319
even CType( "1422.843197465627", Single) also return the same value.
Can somebody explain this to me?
|
|
|
|
|
Are you sure? On my computer, it returns 1422.843 , not .84314 .
You're converting to a single-precision floating point number[^]. The documentation is quite clear: Quote: A Single value has up to 7 decimal digits of precision, although a maximum of 9 digits is maintained internally.
If you want more precision, use a double precision floating point number[^] instead, which supports up to 17 digits.
But be aware that neither type can guarantee to precisely represent every decimal number you throw at it. For example, 0.1 doesn't have a precise binary representation.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I've created a custom tooltip control using a UserControl as the base. When dragging the
control from the toolbox to the form it displays the control (of course) but I want it to
be added like a ToolTip when it is dragged to the form; as an object displayed below the form
in the designer. I've been searching for an answer but I'm not even sure what question to
search for. Can someone help?
Thanks
|
|
|
|
|
Inheriting from UserControl was the wrong route to take. In order for it to show up below the form in the designer, you inherit from Component, not UserControl.
ToolTip is not a normal control. It's an extender that modifies other controls. It adds functionality to anything that inherits from System.Windows.Forms.Control.
The standard ToolTip class inherits from Component and implements the IExtenderProvider interface. You can see the source for ToolTip here[^].
|
|
|
|
|
Thanks a lot for the information and link. I will try that road instead.
|
|
|
|