Click here to Skip to main content
15,898,987 members
Home / Discussions / C#
   

C#

 
AnswerRe: Getting ToolStrip button's CheckState to reflect RichTextBox content Pin
Cassandra Ross14-Jan-09 11:43
Cassandra Ross14-Jan-09 11:43 
AnswerRe: Getting ToolStrip button's CheckState to reflect RichTextBox content Pin
Member 263050315-Jan-09 4:50
Member 263050315-Jan-09 4:50 
QuestionBindng and display problem Pin
wi5nia14-Jan-09 9:52
wi5nia14-Jan-09 9:52 
AnswerRe: Bindng and display problem Pin
Wendelius14-Jan-09 11:14
mentorWendelius14-Jan-09 11:14 
QuestionRe: Bindng and display problem Pin
wi5nia14-Jan-09 11:22
wi5nia14-Jan-09 11:22 
AnswerRe: Bindng and display problem Pin
Wendelius14-Jan-09 11:28
mentorWendelius14-Jan-09 11:28 
GeneralRe: Bindng and display problem Pin
wi5nia14-Jan-09 11:31
wi5nia14-Jan-09 11:31 
GeneralRe: Bindng and display problem Pin
Wendelius14-Jan-09 11:44
mentorWendelius14-Jan-09 11:44 
Okay, then you have at least two options. You can modify your SQL statement and create an additional column and bind to it, like (there may be typos in the examples):
string sql = "select LastName, FirstName, Company, <code>COALESCE(LastName, Company) AS ListData </code>"
             + "from TestTable";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet dataset1 = new DataSet();
da.Fill(dataset1, "TestTable");
listBox1.DataSource = dataset1.Tables["TestTable"];
listBox1.DisplayMember = "<code>ListData</code>";

or after filling the dataset, you can create a computed column:
string sql = "select LastName, FirstName, Company "
             + "from TestTable";
SqlConnection conn = new SqlConnection(connString);
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
DataSet dataset1 = new DataSet();
da.Fill(dataset1, "TestTable");
<code>dataset1.Tables["TestTable"].Columns.Add("ListData", 
                                         typeof(string), 
                                         "ISNULL(LastName,Company)");</code>
listBox1.DataSource = dataset1.Tables["TestTable"];
listBox1.DisplayMember = "ListData";


Hope it helps.

The need to optimize rises from a bad design.My articles[^]

GeneralRe: Bindng and display problem Pin
wi5nia14-Jan-09 11:53
wi5nia14-Jan-09 11:53 
GeneralRe: Bindng and display problem Pin
Wendelius14-Jan-09 12:00
mentorWendelius14-Jan-09 12:00 
QuestionXDate in ZedGraph Pin
Rayya14-Jan-09 9:23
Rayya14-Jan-09 9:23 
AnswerRe: XDate in ZedGraph Pin
EliottA14-Jan-09 12:44
EliottA14-Jan-09 12:44 
QuestionTelephone answering mechine service c# Pin
rikigr414-Jan-09 8:40
rikigr414-Jan-09 8:40 
AnswerRe: Telephone answering mechine service c# Pin
#realJSOP14-Jan-09 9:46
professional#realJSOP14-Jan-09 9:46 
GeneralRe: Telephone answering mechine service c# Pin
User 665814-Jan-09 10:09
User 665814-Jan-09 10:09 
AnswerRe: Telephone answering mechine service c# Pin
Rutvik Dave14-Jan-09 11:18
professionalRutvik Dave14-Jan-09 11:18 
GeneralRe: Telephone answering mechine service c# Pin
rikigr414-Jan-09 21:18
rikigr414-Jan-09 21:18 
GeneralRe: Telephone answering mechine service c# Pin
yafa15-Jan-09 4:03
yafa15-Jan-09 4:03 
AnswerRe: Telephone answering mechine service c# Pin
gisa shel riki14-Jan-09 22:08
gisa shel riki14-Jan-09 22:08 
QuestionHow to determine if two C# exe come from the same source Pin
cwster14-Jan-09 8:03
cwster14-Jan-09 8:03 
AnswerRe: How to determine if two C# exe come from the same source Pin
Scott Dorman14-Jan-09 9:00
professionalScott Dorman14-Jan-09 9:00 
GeneralRe: How to determine if two C# exe come from the same source Pin
cwster14-Jan-09 9:39
cwster14-Jan-09 9:39 
GeneralRe: How to determine if two C# exe come from the same source Pin
Scott Dorman14-Jan-09 9:43
professionalScott Dorman14-Jan-09 9:43 
GeneralRe: How to determine if two C# exe come from the same source Pin
cwster14-Jan-09 9:54
cwster14-Jan-09 9:54 
GeneralRe: How to determine if two C# exe come from the same source Pin
Scott Dorman14-Jan-09 9:57
professionalScott Dorman14-Jan-09 9:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.