|
the syntax is like this:
Dim ia() As Int16 = {0, 1, 2}
vb - does not like values like 0xc960 however...
|
|
|
|
|
It's an array of integers:
Dim lunarInfo As Integer() = { &H4bd8, &H4ae0, &Ha570, &H54d5, &Hd260, &Hd950, &H5554, &H56af, &H9ad0, &H55d2, _
&H4ae0, &Ha5b6, &Ha4d0, &Hd250, &Hd295, &Hb54f, &Hd6a0, &Hada2, &H95b0, &H4977, _
.
.
.... }
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I must say thanks to both of you.
But, your answers look like different.
Which one is correct?
int16 or integer?
And VB really can use the code like "&H4bd8",Dave Kreskowiak?
Really thanks again.
|
|
|
|
|
Int16 is a signed 16-bit integer. Integer is a signed 32-bit integer. The number you're looking at would all fit into 16-bit integers, but which type you use would depend on the math you're doing. I would assume that these numbers are used in other calculations which may involve floating poiint math, so using full processor-width numbers would probably make your app perform a bit better.
And yes, VB can understand &H4BD8. The "&H" just means that this constant is specified in hexadecimal format.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I'm writing a text editor program, what I want to know is when attempting to print to a non-existent printer the program still sends the document to the print queue.
How do I tell the user that no printer is available and cancel the document from being sent to the printer queue?
|
|
|
|
|
Anybloodyid wrote: when attempting to print to a non-existent printer
If the printer doesn't exist, you can't print to it. Are you asking if the printer object exists, but is unavailable??
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
|
Why would you want to do this? I've paused print queues before so I could stack up jobs and go load different paper into a printer before they printed. Isn't this an option best left up to the user?
Ask yourself these questions first. Have you seen this kind of functionality in any other Windows app before? Why or why not?
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
|
Hello,
Looking for everyone's opinion:
If my application references files/objects that aren't actually used in the app. does this "hurt" performance or is dotnet smart enough to realize that those aren't used so there is no performance hit.
Ex: I have a suite of controls that most of the time only 2 or 3 are used out of 10. I have a developer that referenced all 10 even though his app only used 2, then does the other 8 make an impact?
Thanks,
Nathan
-- modified at 14:12 Monday 2nd April, 2007
|
|
|
|
|
nlarson11 wrote: If my application references files/objects that aren't actually used in the app. does this "hurt" performance
No. Only the stuff that gets used affects performance.
nlarson11 wrote: Ex: I have a suite of controls that most of the time only 2 or 3 are used out of 10. I have a developer that referenced all 10 even though his app only used 2, then does the other 8 make an impact?
No. Again, only the stuff that gets used affects performance. If you don't use a control in a library, it can't affect the apps performance. That is, unless the library is HUGE in size and it takes forever to load the assembly. But 10 controls in your library won't make any difference at all.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks Dave for replying...
Sorry for not being more clear...I guess that what I'm really getting at: the start up time...is it impacted by "dead" references?
|
|
|
|
|
No since references that are never used don't make it into the final .EXE.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
great... thank you sir...
|
|
|
|
|
is there any possible keyword in vb.net that can get me
out of the case loop under the select statement..
i want it to work exactly like c++
plz help
|
|
|
|
|
|
I though this question looked familiar[^].
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
man exit select select let us out of the select statement..
what if i m using 3 case loops inside n i want to exit those case loops
whenever the condition is not true, n jump on to the next case
|
|
|
|
|
You don't have to do anything. There is no break in VB because it happens automatically.
If the first Case isn't true, Select automatically jumps to the next Case and tests it, and so on down the line until it find one that is True or it gets to Case Default .
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
The WSDL appears to work file when browsing the web service using the URL in
IE. I even enabled remote testing on the page and was able to successfully test. Trying to call the web service in my VB Windows application fails as indicated and I recieve System.net.webException with no blank error message.
|
|
|
|
|
Hey guys, I'm making a program that creates a customized message box, but it keeps giving me an error. The "IconChoice" variable determines what icon shows up in the messagebox, the "ButtonChoice" variable determines what buttons will show up, and the "DefaultButton" variable determines which button is the default one. The txtMessage and txtTitle are the box's text and title. Here's the code:
<code> Dim IconChoice As String
Dim ButtonChoice As String
Dim DefaultButton As String
Private Sub radbtn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radbtn1.Click
raddef1.Enabled = True
raddef2.Enabled = True
raddef3.Enabled = True
raddef4.Enabled = False
raddef5.Enabled = False
raddef6.Enabled = False
raddef7.Enabled = False
ButtonChoice = "MessageBoxButtons.AbortRetryIgnore"
End Sub
Private Sub radbtn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radbtn2.Click
raddef1.Enabled = False
raddef2.Enabled = False
raddef3.Enabled = False
raddef4.Enabled = True
raddef5.Enabled = False
raddef6.Enabled = False
raddef7.Enabled = False
ButtonChoice = "MessageBoxButtons.OK"
End Sub
Private Sub radbtn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radbtn3.Click
raddef1.Enabled = False
raddef2.Enabled = False
raddef3.Enabled = False
raddef4.Enabled = True
raddef5.Enabled = True
raddef6.Enabled = False
raddef7.Enabled = False
ButtonChoice = "MessageBoxButtons.OKCancel"
End Sub
Private Sub radbtn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radbtn4.Click
raddef1.Enabled = False
raddef2.Enabled = True
raddef3.Enabled = False
raddef4.Enabled = False
raddef5.Enabled = True
raddef6.Enabled = False
raddef7.Enabled = False
ButtonChoice = "MessageBoxButtons.RetryCancel"
End Sub
Private Sub radbtn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radbtn5.Click
raddef1.Enabled = False
raddef2.Enabled = False
raddef3.Enabled = False
raddef4.Enabled = False
raddef5.Enabled = False
raddef6.Enabled = True
raddef7.Enabled = True
ButtonChoice = "MessageBoxButtons.YesNo"
End Sub
Private Sub radbtn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radbtn6.Click
raddef1.Enabled = False
raddef2.Enabled = False
raddef3.Enabled = False
raddef4.Enabled = False
raddef5.Enabled = True
raddef6.Enabled = True
raddef7.Enabled = True
ButtonChoice = "MessageBoxButtons.YesNoCancel"
End Sub
Private Sub radicon1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon1.Click
IconChoice = "MessageBoxIcon.Asterisk"
End Sub
Private Sub radicon2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon2.Click
IconChoice = "MessageBoxIcon.Error"
End Sub
Private Sub radicon3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon3.Click
IconChoice = "MessageBoxIcon.Exclamation"
End Sub
Private Sub radicon4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon4.Click
IconChoice = "MessageBoxIcon.Hand"
End Sub
Private Sub radicon5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon5.Click
IconChoice = "MessageBoxIcon.Information"
End Sub
Private Sub radicon6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon6.Click
IconChoice = "MessageBoxIcon.None"
End Sub
Private Sub radicon7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon7.Click
IconChoice = "MessageBoxIcon.Question"
End Sub
Private Sub radicon8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon8.Click
IconChoice = "MessageBoxIcon.Stop"
End Sub
Private Sub radicon9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radicon9.Click
IconChoice = "MessageBoxIcon.Warning"
End Sub
Private Sub raddef1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles raddef1.Click
DefaultButton = "MessageBoxDefaultButton.Button1"
End Sub
Private Sub raddef2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles raddef2.Click
If radbtn1.Checked Then
DefaultButton = "MessageBoxDefaultButton.Button2"
Else
DefaultButton = "MessageBoxDefaultButton.Button1"
End If
End Sub
Private Sub raddef3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles raddef3.Click
DefaultButton = "MessageBoxDefaultButton.Button3"
End Sub
Private Sub raddef4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles raddef4.Click
DefaultButton = "MessageBoxDefaultButton.Button1"
End Sub
Private Sub raddef5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles raddef5.Click
If radbtn6.Checked Then
DefaultButton = "MessageBoxDefaultButton.Button3"
Else
DefaultButton = "MessageBoxDefaultButton.Button2"
End If
End Sub
Private Sub raddef6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles raddef6.Click
DefaultButton = "MessageBoxDefaultButton.Button1"
End Sub
Private Sub raddef7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles raddef7.Click
DefaultButton = "MessageBoxDefaultButton.Button2"
End Sub
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
MessageBox.Show(""" & txtMessage.Text & """, """ & txtTitle.Text & """, ButtonChoice, IconChoice, DefaultButton)
End Sub</code>
|
|
|
|
|
You can't use string values as if they were enum values. Declare the variables as the proper enums instead:
Dim IconChoice As MessageBoxIcon<br />
Dim ButtonChoice As MessageBoxButtons<br />
Dim DefaultButton As MessageBoxDefaultButton
Now assign the variables the enum values instead of strings:
IconChoice = MessageBoxIcon.Stop<br />
ButtonChoice = MessageBoxButtons.YesNo<br />
DefaultButton = MessageBoxDefaultButton.Button3
Now the variable will work in you call to MessageBox.Show .
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi all !
I have a file Info.dat, Now i want to read content of this file( I know struct of this file). how can i do ? Thanks a lot. Please send to caoquanghanh@yahoo.com
example:
Type PutAd_File
TradeID As Integer
SecNo As Integer
vol As Long
price As Double
FirmNo As Long
Side As String * 1
Board As String * 1
Time As Long
Flag As String * 1
End Type
hanhquang
|
|
|
|
|
caoquanghanh wrote: Please send to caoquanghanh@yahoo.co
Expect answer in the forum, not to your email. This is not a billboard.
caoquanghanh wrote: I have a file Info.dat, Now i want to read content of this file( I know struct of this file). how can i do ?
You can use the BinaryReader class to read the data from the file.
---
single minded; short sighted; long gone;
|
|
|
|
|
I can't find BinaryReader class wijt VB code. Can you help me. thanks alot
hanhquang
|
|
|
|