>>HI, All >>i don't know how to set the data structure DataGridViewTextBoxColumn, DataGridViewComboBoxColumn in Datagriderview >> < In this time, i want to change the countryid as 國家........Dim colcombo As New DataGridViewComboBoxColumn >> ' and i want countryid as 國家, is select in country talbe 's key >>' so countryid as 國家 is a foreignkey in this table, but in country table is primary key >> >>My table has 3 fields, this is my code >> >>Dim qs As String = "select storeid as 貨主編號, countryid as 國家 , storename as 貨主名稱 from storer" >> >> da = New SqlDataAdapter(qs, cn) >> da.Fill(ds, "Storer") >> >> Me.StorerBindingSource.DataSource = ds.Tables("Storer") >> >> Me.dg.DataSource = Me.StorerBindingSource >> >> Dim col As New DataGridViewTextBoxColumn >> col = dg.Columns(0) >> col.MaxInputLength = 10 >> col = dg.Columns(1) >> col.MaxInputLength = 20 >> col = dg.Columns(2) >> col.MaxInputLength = 50 >>>
>dg.Columns(0).MaxInputLength = 10 >dg.Columns(1).MaxInputLength = 20 >dg.Columns(2).MaxInputLength = 50 >>There is no need of col definition.