473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DataTextField Conversion Question



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
1 2685
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
1
by: NBB | last post by:
I can't figure this one out. Here's the situation, should be pretty for the pros in here. I have a ListBox that is populated with the DataTextField and DataValueField flags of the DataSet....
2
by: Angela | last post by:
Hi everyone, Is it possible to bind the DataTextField property to two values from a database. I would like the text from column("book") and the text from column("code") to appear in the...
1
by: Sam | last post by:
I want to create dropdownlist where DataTextField and DataValueField are extract from table gldate. Example Dropdownlist -> Jan-2005 -> Feb-2005 ... ... -> Dec-2005
47
by: rawCoder | last post by:
Hi, Just wanted to know if there is any speed difference between VB conversion Keywords like CInt, Clng, CStr, CDbl, CBool etc. ..NETs Convert.To<...> methods. And which is better to be...
5
by: Mark Rae | last post by:
Hi, Here's one just for my own interest - I know how to add ListItems programatically, and how to concatenate fields in SQL queries... But, is there any way to specify anything other than a...
1
by: Eric Layman | last post by:
Hi I am attempting to bind data to a dropdownlist. Currently the below code will bind a persons last name just find using the datatextfield. What I would like to do though, is also be able to...
21
by: REH | last post by:
It it permissible to use the constructor style cast with primitives such as "unsigned long"? One of my compilers accepts this syntax, the other does not. The failing one chokes on the fact that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.