Hi, I am using a database. And return the data to a DataSet dsPlayers. Some players have a birthday, which is a DateTime field, and some do not. These have no value so it says . I want to put their birthday to a DateTimePicker dtpBirthday, but when it is I want to give the DateTimePicker the value DateTime.Now. I have the following code, which is noit working for me. if (dsPlayer.Players[0].BirthDay.ToString() == null) { dtpBirthday.Value = DateTime.Now; } else { dtpBirthday.Value = dsPlayer.Players[0].BirthDay; }
What is the best way to make this if statement?
beqs
Posts
-
Cannot get value because it is DBNull -
Multiple values in ComboBox.DisplayMemberHow stupid? I know it now:
dc.Expression = "FullName + (' [')+ TeamName + (']')";
Thanx anyway... -
Multiple values in ComboBox.DisplayMemberThanx Mohamad. This is the solution for me! But one other thing This works for me:
dc.Expression = "FullName + (' ')+ TeamName";
But I prefer an outcome like: FullName [TeamName] I tried the following but it gives an error:dc.Expression = "FullName + (' [')+ TeamName" + (']');
How can I achieve this the right way? -
Multiple values in ComboBox.DisplayMemberHope someone can help me. I want to add two values in a combobox. It's for players of a team. Now I have done it as follow with an DataSet:
cbPlayers.DataSource = dsPlayers.Tables["Players"]; cbPlayers.ValueMember = "PlayerID"; cbPlayers.DisplayMember = "FullName";
This gives a combobox filled with only playernames But I also would like to include the team name behind the playername in this combobox. Who can help me out?:confused: