Newbie-define textbox datasource within the source code.

G

Guest

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!
 
G

Guest

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
 
G

Guest

I should also add that I am using a select statement to fill the dataset with
one record.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top