By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,673 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,673 IT Pros & Developers. It's quick & easy.

DataTextField Conversion Question

P: n/a


Hello,
I am have a web service which I pull a dataTable and then fill a
listBox with the information.

On the ListBox1.DataTextField = "myColumn";

I need to attempt the following:

DateTime myColumn = new DateTime;

myColumn = myService.returnDataTableFunction;

ListBox1.DataSource = myService.ReturnDataTableFunction;
ListBox1.DataTextField = myColumn.ToShortDateString();

I am not getting the text value of the dataTable. My SQL Statement is as
follows:

Select top 5 week from myTable order by week desc.

I am not sure what I am missing. Any advise would help.

Thanks,

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jason,

The way you are setting the DataTextField is incorrect. You want to set
this property to the name of the field in the table that contains the value
you want to display.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Jason Heine" <ja*********@dell.com> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl...


Hello,
I am have a web service which I pull a dataTable and then fill a
listBox with the information.

On the ListBox1.DataTextField = "myColumn";

I need to attempt the following:

DateTime myColumn = new DateTime;

myColumn = myService.returnDataTableFunction;

ListBox1.DataSource = myService.ReturnDataTableFunction;
ListBox1.DataTextField = myColumn.ToShortDateString();

I am not getting the text value of the dataTable. My SQL Statement is as
follows:

Select top 5 week from myTable order by week desc.

I am not sure what I am missing. Any advise would help.

Thanks,

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.