itprochris
asked on
Inserting Line
I am trying to make a simple code generator for my Database classes. I have the following code:
Dim line As Integer = 0
Me.OutputText.Lines(line). Insert(0, "Public Class CLASSNAME") 'i would have replaced the classname manually later
line = line + 1
Dim i As Integer = 0
For i = 0 To i = (Me.DataGridView1.Rows.Cou nt - 1)
Me.OutputText.Lines(0).Ins ert(0, "Private _" + Me.DataGridView1.Rows(i).C ells(0).To String + " as " + Me.DataGridView1.Rows(i).C ells(1).To String)
i = i + 1
line = line + 1
Next
What I am trying to do is have my datagrid's rows create a variable declare statement each on a seperate line in the OutputText textbox. What is wrong with this code? It says that the index is outside of the bounds of the array. And also, what can I do to make this more efficient? Thanks!
Dim line As Integer = 0
Me.OutputText.Lines(line).
line = line + 1
Dim i As Integer = 0
For i = 0 To i = (Me.DataGridView1.Rows.Cou
Me.OutputText.Lines(0).Ins
i = i + 1
line = line + 1
Next
What I am trying to do is have my datagrid's rows create a variable declare statement each on a seperate line in the OutputText textbox. What is wrong with this code? It says that the index is outside of the bounds of the array. And also, what can I do to make this more efficient? Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, the vbCrLf constant is a "visual basic carriage return line feed" character -- equivalent to Chr(10) & Chr(13) -- which is a new line. :)
Now..... if your textbox is sized such that there's only one line visible... you'll have to resize it.
Also... is there a reason you're not Using something like a listbox to display the data?
Now..... if your textbox is sized such that there's only one line visible... you'll have to resize it.
Also... is there a reason you're not Using something like a listbox to display the data?
ASKER
I am getting errors on the last line that says that the index is outside of the bounds of the array. Could it be because I am using VB.NET 2005 Express Beta?
Also, I am not using a listbox because I need to be able to copy the output.
Thanks
Also, I am not using a listbox because I need to be able to copy the output.
Thanks
ASKER
Nevermind, I figured out the problem .Thanks for the help!
If you figured out the problem, you ought to post the solution here... in case someone else has the same problem...
ASKER
Thanks!