|
i found no examples for this subject.i don't have any idea where to start ?
|
|
|
|
|
I don't think if anyone can give you the whole coding for the purpose. Therefore, I suggest you to examine MSDN and search about system.io then you will discover teh whole thing. I am showing you a pin-hole.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Private Sub GetTheSizes(ByVal sDir As String)
Dim saFiles() As String = Directory.GetFiles(sDir)
Dim oFile As FileInfo = Nothing
For Each sFile As String In saFiles
oFile = New FileInfo(sFile)
MsgBox(oFile.Name & " is " & oFile.Length & " in size.")
'or add the line to a listbox or whatever
Next
End Sub
|
|
|
|
|
I am having a discussion with a college about evaluating an expression with Visual Basic.
It is centered around that an "If" statement is evaluated from Left to Right. So, once the expression is found True or False, the remaining portion of the expression is not evaluated.
Consider the follow:
<br />
If (C = 3) And ((B / A) > 1) Then<br />
MsgBox "checking If statement"<br />
End If<br />
If the value of "A" is zero, this would cause an execution violation. This should only happen if "C" has the value of 3. In Visual Basic, the right side of the statement is being evaluated no matter what the value of "C" is. In the many "C" compilers that I have worked with, the second half of the statement would be ignored as long as "C" was not equal to 3.
If somebody could shed some light on this issue, it would be appreciated.
Also, is there a way in the Visual Basic environment to view the assembly code?
Thank you.
Eldon Zacek
|
|
|
|
|
Doesn't VB have two Boolean AND operators: And and AndIf
One will shortcircuit as soon as the final result is known.
Also, you can always experiment by putting in method calls that output to the console and then return values back to the If statement, then step through the code and see which methods are called and in what order.
|
|
|
|
|
Are you talking about pre-.NET?
If you are talking about VB.NET then using And will evaluate the entire statement period. If you wanted to stop evaluating at the first falsehood then you would use AndAlso or OrElse .
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
The version being used is V6. Sorry I left that out.
Why does VB6 not follow the convention that VC does? Is this something left over from way back when?
Is there a way to get VB6 to perform the evaluation from Left to Right?
Thanks.
Eldon Zacek
|
|
|
|
|
It performs the evaluation from left to right but evaluates the entire statement regardless of any previous false statements contained in the If . Many people picked up the bad habit of programming FOR this so it can be a hassle to upgrade VB6 to .NET when you have to reproduce someone coding for a failure in the If .
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
as said, in vb6 the entire statement is evaluated left to right may not be an accurate statement because ( ) will override that behavior because what's inside the ( ) is evaluated first then resumes exection of left to right.
for the behavior you want, you will need to break the if statement into 2 different statements
If (C = 3) Then
If ((B / A) > 1) Then
MsgBox "checking If statement"
End If
End If
|
|
|
|
|
how to call add(int i,int j) function in a mfc dll from vb application.
I have done all the steps to include c++ MFC dll to vb project.
It is working fine with function calls with no arguments like show();
But it returning garbage value when i call add(5,4) which passes arguments to the function.
my code in vb is like this:
Private Declare Function AddValues Lib "dllmfc.dll" (i,j) As Integer
Private Sub btnadd_Click()
Dim ans As Integer
a = AddValues(5, 4)
MsgBox (a)
End Sub
please tell me where i am wrong.
punit singh
|
|
|
|
|
Does integer mean the same thing in C++ MFC as it does in VB.NET? It may be that you are passing or receiving the incorrect type.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
the vb code that when inserting a cd,automatically we read all files names.
|
|
|
|
|
is it a question? or you need a solution...
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Do you mean something like this?
Dim Drive As String = "D:\"
If My.Computer.FileSystem.GetDriveInfo(Drive).IsReady = True Then
For Each File As String In My.Computer.FileSystem.GetFiles(Drive, FileIO.SearchOption.SearchAllSubDirectories)
ListBox1.Items.Add(File)
Next
End If
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
Hi all,
I have a string (for example itcontains "abcde"). I'd like to fill it with spaces until a determined length (for ex. 10) so the final string would be "abcde "
How can I do it?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Marc Soleda wrote: final string would be
Dim StrLength as Int32 = 10
Dim myString = "abcde"
Dim addSpace as Int32 = 10 - myString.length
Dim I as Int32
For I = 1 to addspace
mystring = mystring + " "
next
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
sorry, I missed to tell that I'm looking for a Framework function . For example: I've done the same but filling it with "0" with the "Format" method but with spaces I can't do it. Is there something similar with spaces?
Marc
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
Format() is a VB6 function and for the padding function there is now a .PadLeft and a .PadRight() .
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
strABCDE.PadRight(10) That will take into account the length that already exists and then add the number of spaces or characters in order to finish filling to the required length.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Great !! That's exactly what I was looking for.
thanks,
Marc.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
How do i make an XMLNode a serializable object? do i need to use a wrapper class of some sort?
|
|
|
|
|
XML is serializable by nature, what do you mean?
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Im trying to serialize this class (as shown below) but im getting an error
"The type System.Xml.XmlNode is not marked as serialzable". How do i solve this problem?
<serializable()> _
Public Class Alert
Private mNotificationServer As String
Private mNewHour As Xml.XmlNode
.
.
.
End Class
|
|
|
|
|
Can any one out there help me make a web explorer, if you want to / can help THANKS! , if you dont want to dw Im working in VB
-- Zero --
|
|
|
|
|
There is a web browser under common controls in toolbox. You can use it. You should define imports system.web on top of your application.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|