PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Newbie-define textbox datasource within the source code.
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Newbie-define textbox datasource within the source code.
![]() |
Newbie-define textbox datasource within the source code. |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I am sure this is probably something very simple but I am new to VB .Net and
haven't figured it out up to this point and am tired of trying. Could I get some example source code that sets the datasource of a textbox within the code. The datasource of the textbox varies depending on what the user is trying to do at the time, so I am not setting the datasource from within the designer. I want to pass the value of a field from a dataset to a form textbox. I can successfully do this if I am passing the value from a datagrid as shown in the code below, but I can not seem to get the right syntax to pass the value directly from the dataset bypassing the need for the datagrid. dataGridTable = CType(dgdCurcuitJoin1.DataSource, DataTable) currRow = dataGridTable.Rows(dgdCurcuitJoin1.CurrentRowIndex) f1.txtCustomerName.Text = currRow(55, DataRowVersion.Current) Thanks! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
I think I may have got it but I receive an error.
the following is the code. cmbLODState.DataSource = PostalCodeDataSet.tsmPostalCode.StateIDColumn error is. Complex DataBinding accepts as a data source either an IList or an IListSource "Wishing I was skiing mom" wrote: > I am sure this is probably something very simple but I am new to VB .Net and > haven't figured it out up to this point and am tired of trying. > > Could I get some example source code that sets the datasource of a textbox > within the code. The datasource of the textbox varies depending on what the > user is trying to do at the time, so I am not setting the datasource from > within the designer. I want to pass the value of a field from a dataset to a > form textbox. I can successfully do this if I am passing the value from a > datagrid as shown in the code below, but I can not seem to get the right > syntax to pass the value directly from the dataset bypassing the need for the > datagrid. > > dataGridTable = CType(dgdCurcuitJoin1.DataSource, DataTable) > currRow = dataGridTable.Rows(dgdCurcuitJoin1.CurrentRowIndex) > f1.txtCustomerName.Text = currRow(55, DataRowVersion.Current) > > Thanks! > > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
I should also add that I am using a select statement to fill the dataset with
one record. "Wishing I was skiing mom" wrote: > I think I may have got it but I receive an error. > > the following is the code. > cmbLODState.DataSource = PostalCodeDataSet.tsmPostalCode.StateIDColumn > > error is. > Complex DataBinding accepts as a data source either an IList or an IListSource > > > > "Wishing I was skiing mom" wrote: > > > I am sure this is probably something very simple but I am new to VB .Net and > > haven't figured it out up to this point and am tired of trying. > > > > Could I get some example source code that sets the datasource of a textbox > > within the code. The datasource of the textbox varies depending on what the > > user is trying to do at the time, so I am not setting the datasource from > > within the designer. I want to pass the value of a field from a dataset to a > > form textbox. I can successfully do this if I am passing the value from a > > datagrid as shown in the code below, but I can not seem to get the right > > syntax to pass the value directly from the dataset bypassing the need for the > > datagrid. > > > > dataGridTable = CType(dgdCurcuitJoin1.DataSource, DataTable) > > currRow = dataGridTable.Rows(dgdCurcuitJoin1.CurrentRowIndex) > > f1.txtCustomerName.Text = currRow(55, DataRowVersion.Current) > > > > Thanks! > > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

