|
-
Jul 26th, 2005, 03:46 PM
#1
Thread Starter
Addicted Member
By name and not By index
when I want to change parameters in column I have to write the index of the column and not the name
for example
this code work good
Dim dtchild As DataTable = New DataTable
dtchild.Columns.Add("cID", GetType(System.Int32))
dtfather.Columns(1).Unique = True
but here I get error
Dim dtchild As DataTable = New DataTable
dtchild.Columns.Add("cID", GetType(System.Int32))
dtfather.Columns("cID").Unique = True
the Same problem with dataTable
this code is OK
For Each ro In ds.Tables(0).Rows
and here I got error
For Each ro In ds.Tables("dtfather").Rows
how can I use the name and not the indexes?
thanks alot
-
Jul 26th, 2005, 03:51 PM
#2
Thread Starter
Addicted Member
and another question
in access I can lock the combobox
me.combo1.locked = true
in vb.net there is no this option
I can just to Enabled but then its change the color and its not good for me
Is there a way to locked the combo and not by Enabled?
thanks again
-
Jul 26th, 2005, 08:51 PM
#3
Re: By name and not By index
 Originally Posted by 24sharon
when I want to change parameters in column I have to write the index of the column and not the name
for example
this code work good
Dim dtchild As DataTable = New DataTable
dtchild.Columns.Add("cID", GetType(System.Int32))
dtfather.Columns(1).Unique = True
but here I get error
Dim dtchild As DataTable = New DataTable
dtchild.Columns.Add("cID", GetType(System.Int32))
dtfather.Columns("cID").Unique = True
the Same problem with dataTable
this code is OK
For Each ro In ds.Tables(0).Rows
and here I got error
For Each ro In ds.Tables("dtfather").Rows
how can I use the name and not the indexes?
thanks alot
dunno what happend to your machine but it works in my machine
VB Code:
Dim ds As New DataSet()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
values()
Me.DataGrid1.DataSource = ds.Tables("dt")
Dim r As DataRow
For Each r In ds.Tables("dt").Rows
MessageBox.Show(r(0).ToString)
Next
End Sub
Sub values()
Dim s() As String = {"awe3cg", "waheh", "askdjf", "lkajsd"}
ds.Tables.Add("dt")
ds.Tables("dt").Columns.Add("name")
ds.Tables("dt").Columns("name").Unique = True
Dim i As Integer
For i = 0 To UBound(s)
Dim d As DataRow = ds.Tables("dt").NewRow
d(0) = s(i)
ds.Tables("dt").Rows.Add(d)
Next
End Sub
-
Jul 27th, 2005, 08:43 AM
#4
Thread Starter
Addicted Member
Re: By name and not By index
mar_zim
Thanks!
did someone know the replay to my second question?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|