PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms Newbie-define textbox datasource within the source code.

Reply

Newbie-define textbox datasource within the source code.

 
Thread Tools Rate Thread
Old 01-06-2005, 10:22 PM   #1
=?Utf-8?B?V2lzaGluZyBJIHdhcyBza2lpbmcgbW9t?=
Guest
 
Posts: n/a
Default Newbie-define textbox datasource within the source code.


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!



  Reply With Quote
Old 01-06-2005, 10:41 PM   #2
=?Utf-8?B?V2lzaGluZyBJIHdhcyBza2lpbmcgbW9t?=
Guest
 
Posts: n/a
Default RE: Newbie-define textbox datasource within the source code.

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

  Reply With Quote
Old 01-06-2005, 11:16 PM   #3
=?Utf-8?B?V2lzaGluZyBJIHdhcyBza2lpbmcgbW9t?=
Guest
 
Posts: n/a
Default RE: Newbie-define textbox datasource within the source code.

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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off