开发者

how to combine combo box contents in vb.net

开发者 https://www.devze.com 2022-12-23 07:17 出处:网络
I have this, birthday selection which is in 3 combobox, 1 for month, 1 for day and 1 for year. But my database table has only this birthday attribute(no year, month or day).

I have this, birthday selection which is in 3 combobox, 1 for month, 1 for day and 1 for year. But my database table has only this birthday attribute(no year, month or day). How can I combine the items that are selecte开发者_JAVA百科d in those 3 combo boxes so that they would be fitting in the birthday column?


If the items in your combobox are strings, you could do something like this:

Dim Day As Integer = Integer.Parse(ComboBoxDay.SelectedItem.ToString())
Dim Month As Integer = Integer.Parse(ComboBoxMonth.SelectedItem.ToString())
Dim Year As Integer = Integer.Parse(ComboBoxYear.SelectedItem.ToString())

Dim MyDate As New DateTime(Year, Month, Day)
0

精彩评论

暂无评论...
验证码 换一张
取 消