|
|
that link would be good if it was for VB6 though, but that array creation you vill have to explain some more
|
|
|
|
|
VB6 is no longer supported, people will assume you're asking about VB.NET unless you say otherwise. VB6 is useless, I'd have to ask why your school teaches it. VB.NET 2005 Express is free, they should be using that, if you must learn VB.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok here:
Dim i() As Integer 'create a array of ints with 0 length
For j As Integer = 0 To 1000000000
ReDim Preserve i(j) ' redefine the array in memory, keeping the existing values
i(j) = j
Next
return i
advice:
1) everything is reference in VB (except integral primatives like ints )
2) arrays are declared to have a lengthh adn don't like it when their boundries are broken
3) mixing .count and .length lead to trying to remember which is "0 based" and which is "1 based"
4) if you get an indexOutOfRange violation check your iterators
5) redim is your friend
6) collections are often a better choice
7) avoid mixing collections and arrays (collections are 1 based and always have >= 1 member)
8) use for each when ever applicable (another reason to avoid mixing arrays with collections)
this really should all be in your textbook. Look it up...
good luck
hey...slang is the vernacular for the vernacular...wow
|
|
|
|
|
thank you, i will try some of this code ASAP ^^
and yes i agree, VB6 is old but i guess its all about the license stuff >_>
|
|
|
|
|
I have the source code of a vb program. What is the best way to convert or rewrite the code into vb.net?
|
|
|
|
|
There is no easy way. There is an upgrade wizard, but it's not very good, because the languages are so totally different.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I think… open your VB6 project by using Visual Studio (Wizard ), get an idea and rewrite, by creating a new project - is the best way. .
Regards,
Chatura Dilan
If at first you don't succeed, try; try again, so that you know
what not to do the next time. The answer is out there.
|
|
|
|
|
I am trying to create a winform with a datagrid. However I would like to reload/Refresh the data every 5 minutes. I am trying to use a timer but it doesn't look like it is working. I have it firing off an event every 6000 milliseconds (6 Seconds). When I change some data in my database the data in datagrid is not changing. I searched for timer and winform but couldn't find anything that helps. Any help would be appreciated.
Thanks for all the help
NewbieDave
|
|
|
|
|
Well, what you're trying to do is right. The core question would be, is your timer set up so that it's firing, and if so, what does the event code look like that it's not doing what you hope ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ok so here is my problem,
I am creating a data migration prog for my company and at the end I am giving them an option to copy over files based on file extension(mainly for developers with jar files and numerous others) Right now My form has a text box and a list view with an add button. A person would type in a file extension and click add which adds the extension into the listview box.
The quesion is, is there anyway to make/get the array for the extensions in the listview. I did some reading and it seems that only if the items in the listview are selected will I be able to get an array from it, is there way in code to select all items in the listview?
Here is some of my code.
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
Dim myArray, myArray2, i, TestText
myArray = lstExt.Items
MsgBox(myArray(0))
For i = 0 To UBound(myArray)
If i = 0 Then
TestText = myArray(i)
Else
TestText = "*." & TestText & " " & myArray(i)
End If
Next
MsgBox(TestText)
End Sub
Thanks
Bob
|
|
|
|
|
I'm using VB in VS2005 on a WXP SP2 machine to build a windows service that listens to a port to accept messages. This solution works fine when a connecting client sends a message, waits for an ACK and disconnects. We now want the socket to remain OPEN after sending the ACK, which it used to do on beta2 and older machines.
Does anyone know which property to set or another solution to keep the socket open after the send.
Any ideas?
Bert Maes
Here's the code:
Public Sub StartGateway()
CommServerListener = New TcpListener(IPAddress.Parse(HostIpAddress), CommServerUnsollicitedPort)
CommServerListener.Start()
Timer2 = New System.Timers.Timer(1000)
Timer2.Enabled = True
End Sub
Public Sub Timer2_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer2.Elapsed
If h.CommServerListener.Pending() Then
Timer2.Enabled = False
ProcessCloverleafRequest()
Timer2.Enabled = True
End If
End Sub
Public Sub ProcessCloverleafRequest()
Dim Buffer As Byte() = New Byte(TcpBufferSize) {}
Dim NumberOfBytes As Integer
Dim Temp As String
Dim msg As String
Dim iStart, iEnd As Integer
If ListenerSocket Is Nothing Then
ListenerSocket = CommServerListener.AcceptSocket
End If
Temp = String.Empty
If ListenerSocket.Available > 0 Then
ReDim Buffer(ListenerSocket.Available)
NumberOfBytes = CInt(ListenerSocket.Available)
ListenerSocket.Receive(Buffer, Buffer.Length, SocketFlags.None)
If NumberOfBytes > 0 Then
'....do stuff
'when finished echo message
ListenerSocket.Send(Buffer, 0, Buffer.Length, SocketFlags.none)
'Here one would expect that this instruction doesn't close the connection
'anyway the connection should stay open
End Sub
|
|
|
|
|
I have been developing a web site using VS.Net/VB.Net. And I now have a fairly big site. Is it possible to put them in a format that is viewable outside of the C:\Inetpub\wwwroot folder?
Like would it be possible to compile it in a manner and email it to people? Because I don't want to put it on the net.
|
|
|
|
|
Is it possible to put IIS on a cd and run a web page from a cd?
|
|
|
|
|
you won't need to put IIS on a CD..
just copy it onto a CD.. assuming that you copy across all custom dll's etc
it will work on any machine that has .net framework installed on it
Simon
|
|
|
|
|
How do you mean "Copy it across"?
And how would I get it working on a machine that doesn't have the .net framework installed?
|
|
|
|
|
It doesn't work without the net.framework. It shouldn't be a problem, it's a free download.
|
|
|
|
|
actually I just read somthing about a thumbdrive with a full appache server on it. works on most any PC it's plugged into. nifty
hey...slang is the vernacular for the vernacular...wow
|
|
|
|
|
I am working in visual basic and trying to find how to take a date that is provided in international date format (ie 05.05.06) and convert it to another international date format (ie 05/05/06). The problem lies both in the delimeter differences and the mm/dd vs dd/mm formats. Has anyone done this in VB? I need to be able to convert from one format to the current regional setting, but I may not know what format the incoming date is in.
|
|
|
|
|
hi every body.i use (Mscomm32.ocx)ocx from vb6 to vb.net 2003.but when run my application display message ::
{An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in modemApp.exe
Additional information: COM object with CLSID {648A5600-2C6E-101B-82B6-000000000014} is either not valid or not registered.
}please some body help, please example
123
|
|
|
|
|
dude, kool it on the dup posts.
that said,
to register an ocx, use the regsrv32 command in the shell.
running command strings in VB.net is pretty easy, with teh shell verb
dim x as string = "regsrv32 mscomm32.ocx /s"
shell(x, -windowstate-, -wait-, -timeout- )
you can add this code to the install package by overriding the Install method. there is a great tutorial on this site about "Conditional Installer packages" that discusses how to do just that, so you can ask where to put desktop and quicklaunch shortcuts. it's pretty good.
Good luck
hey...slang is the vernacular for the vernacular...wow
|
|
|
|
|
hi every body. i need to help.
i use (Mscomm32.ocx)ocx from vb6 to vb.net 2003.but when run my application display message ::
{
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in modemApp.exe
Additional information: COM object with CLSID {648A5600-2C6E-101B-82B6-000000000014} is either not valid or not registered.
}please some body help, please example
123
|
|
|
|
|
hi every body. i need to help.
i use (Mscomm32.ocx)ocx from vb6 to vb.net 2003.but when run my application display message ::
{
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in modemApp.exe
Additional information: COM object with CLSID {648A5600-2C6E-101B-82B6-000000000014} is either not valid or not registered.
}
please some body help, please example
123
|
|
|
|
|
i need to mscomm32.ocx (from vb 6)
123
|
|
|
|
|
Hi,
I have a table called tblUsers that displays all my users. What I want to do is when the user launches my form, for it to say Welcome "userloginName" on a label. So my form has to check to see if it is a valid user against (tblUsers).
How can I accomplish this?
Thanks,
Rashar
|
|
|
|