|
You've created a jagged array (an array of arrays). When you do this each element points to another array. The array's initially aren't created. I think this is why you get the error. Take this for example
Dim data(5)() As String
data(0) = New String() {"Data1", "Data2", "Data3"}
Console.WriteLine(data(0)(0))
' The next line will throw an error because the 2nd element
' doesn't point to an array yet.
Console.WriteLine(data(1)(0))
What's probably happening is you are only reading x number of rows, so only the first x elements have been initialized properly. Trying to read beyond x will throw an error. You could initialize all the elements first like so:
For i As Integer = 0 To data.Length - 1
data(i) = New String() {}
Next
Or you can just make sure you don't read beyond the number of lines read.
|
|
|
|
|
I made a software with SQL server 2000 as databse in Vb.net.it works quite well.But when want run it on another computer i have to configure the windowApplication1.exe.config file and have to provide the name of the server,database,username,password manually.Can i do it grom the fron end when yhe software starts.
I want know more about .net
|
|
|
|
|
So, you chose to ignore the reply to your previous post, of the exact same question, you put up 3 hours ago?? Any particular reason??
Like the other reply said, you have to modify the connection string you saved in the app.config file. You can either do some simple string manipulation at runtime to replace the database path, username and password, ...
Or, you can modify the string in the app.config file with a configuration tool you build into your app or you build into a custom action in your app's installer. This method requires that you load the app.config as an XML document, make the changes, then rewrite the XML document back out to the app.config file.
|
|
|
|
|
Dave Kreskowiak wrote: you chose to ignore the reply to your previous post, of the exact same question, you put up 3 hours ago?
Oh please, here we go again...
Dave Kreskowiak wrote: Any particular reason?
Maybe he wants to summon some rather cranky people
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi can any one please how to write text in next line of an existing file.
I used below two methods.Itz getting appending at the last in the same line
File.AppendAllText("My file path", text to write)
(or)
My.Computer.FileSystem.WriteAllText("My file path", Text to write, True)
thanx in advance .
Is the above good practice or using FSO object ?pls give me suggestions
|
|
|
|
|
put a 'vbCrLf' (=enter) before you're text to write
File.AppendAllText("My file path", vbcrlf & text to write)
My.Computer.FileSystem.WriteAllText("My file path", vbcrlf & Text to write, True)
should work
|
|
|
|
|
Thank you very much its working dude.
|
|
|
|
|
you can also use following statement
File.AppendAllText("My file path", Controlchars.newline & text to write)
My.Computer.FileSystem.WriteAllText("My file path", Controlchars.newline & Text to write, True)
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
I don't get this at all. Here's the deal:
I have a TextBox. Its properties are:
Text: C:\
Name: TextBox1
Next to the TextBox, i have a button. This is the code under the click event:
Process.Start(TextBox1.Text & "\test.bat")
So when you click the button, the app should run the file test.bat that has been placed in the directory written in the TextBox, C:\ in this case.
The problem is that the batch doesn't run from C:\ , but from C:\Documents and Settings\Atom\Mijn documenten\Visual Studio 2005\Projects\Test_App\bin\Debug
Thats the folder where the debug .exe is located. Why is it running from C:\Documents and Settings\Atom\Mijn documenten\Visual Studio 2005\Projects\Test_App\bin\Debug instead of C:\ ? I need it to run from C:\
Any ideas?
|
|
|
|
|
This is just a guess, but it looks like you are pointing to:
c:\\test.bat instead of c:\test.bat
I would remove one of the \
Hope that helps.
Ben
|
|
|
|
|
Just to clarify, is it running c:\test.bat, but performing tasks on the debug folder?
or is test.bat not running at all?
|
|
|
|
|
I think you will be interested in ProcessStartInfo.WorkingDirectory
groeten
|
|
|
|
|
First, the command line that you're actually running is C:\\test.bat . The two backslashes next to each other work, but could cause you problems later if used indiscriminatly.
Second, the working directory is the directory from where your code is launched. Like Luc said, you have to set the WorkingDirectory[^] property of the ProcessStartInfo object.
Dim psi As New ProcessStartInfo(Path.Combine(TextBox1.Text, "test.bat"))
psi.WorkingDirectory = TextBox1.Text
Process.Start(psi)
|
|
|
|
|
kubben, i removed one of the \ but that didn't fix it. Its still running from the debug folder.
quote: Just to clarify, is it running c:\test.bat, but performing tasks on the debug folder?
Thats right. Its running from the debug folder, i want it to run from C:\
Luc and Dave, that did it!
Thanks to all of you for your quick answers.
http://www.themightyatom.nl
|
|
|
|
|
I have one menu control in my Main Page and menu has 5 menu items, I have one ASPX page which as one button. Initially 2 menu items in the menu will be disabled. On click of button in the aspx page those disabled menu items should be enabled. But it is not working. Bellow is the code for enabling the menu items.
Protected Sub Sumbit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Sumbit.Click
Dim mnControl As Menu
mnControl = CType(Master.FindControl("Menu1"), Menu)
mnControl.Items(0).ChildItems(4).Enabled = True
mnControl.Items(0).ChildItems(5).Enabled = True
mnControl.Items(0).ChildItems(3).Enabled = True
end sub.
Kalyan
|
|
|
|
|
are you getting an error message?
at first sight I would think you're childitems index just be 2,3,4 but normally you should get an index out of range exception
|
|
|
|
|
Some rethorical questions:
how many ChildItems are there ?
are there just buttons ?
how can you tell what the indices are for the buttons you want ?
|
|
|
|
|
I have some project which was built on VB4.0. But i dont have VB4.0, and i want to migrate to the latest vb5.0 or vb6.0 version.
How can i do it?
Thanks in advance.
Regards,
Kamalasubramanian
Kamal
|
|
|
|
|
The last version of the old VB was VB6, and it's no longer sold or supported by Microsoft. The only place you MIGHT find a copy is on EBay.
I HIGHLY suggest you don't bother with it and get VB.NET instead. You can download the free VB.NET Express Edition from here[^].
There is no way to have an automatic conversion of the code. You'll have to rewrite the project from scratch.
|
|
|
|
|
Thanks for your reply. i have the source in binary format. all other sources which are in ASCII format were migrated to VB6.0. But how to convert the sources (*.frm) which are in binary format to the ASCII format?
Thanks & Regards,
Kamalasubramanian K
|
|
|
|
|
*.frm files are not in a binary format. Well, not in VB6 anyway. If these source files are part of a VB4 project, you simply have no conversion tools available to you. You must rewrite the project from scratch in VB.NET.
|
|
|
|
|
i want to store my client's setting for my application, tell me how & where to store that setting, n how it can easily b retrieved!!!.....
how abt XML? bt i dont know how to use it
(Jameel)
|
|
|
|
|
depends on how many settings you want to store and wich settings
for few settings check out:
the settings on a project (you can set the scope to user)
(is located under the properties of you're project)
if you want to store alot of settings I suggest you use a db
|
|
|
|
|
Thanx Frined . I chose the project->settings.... workd
(Jameel)
|
|
|
|
|
you can also look at serialisation but this is not easy and maybe alot of work depending on what you want to store
It requires you write you're own controls then saves the properties (that you tell it to save) to an xml file
|
|
|
|