StrataFrame Forum

Combo Question

http://forum.strataframe.net/Topic15095.aspx

By Michael Reese - 3/21/2008

I have a combo and I am able to successfully fill it utilizing a datatable. I also have it attache to a BO and Column. The problem is that I am not able to populating the bo?

*********************

Private Sub PopulateReminderCombo()

Dim loTable As New DataTable()

Dim loRow As DataRow

'-- Create the table structure

loTable.Columns.Add("Display", GetType(String))

loTable.Columns.Add("DropDown", GetType(String))

loTable.Columns.Add("Value", GetType(TimeSpan))

'-- Add some rows

loRow = loTable.NewRow()

loRow.Item("Display") = "0 minutes"

loRow.Item("DropDown") = "0 minutes"

loRow.Item("Value") = (New TimeSpan(0, 5, 0))

loTable.Rows.Add(loRow)

loRow = loTable.NewRow()

loRow.Item("Display") = "5 minutes"

loRow.Item("DropDown") = "5 minutes"

loRow.Item("Value") = (New TimeSpan(0, 5, 0))

loTable.Rows.Add(loRow)

*******************************************

' Me.cboReminder.Items.Clear()

'-- Associate the table with the combos data source

cboReminder.DataSource = loTable

cboReminder.DisplayMember = "Display"

cboReminder.ValueMember = "Value"

 

 

By Trent L. Taylor - 3/24/2008

The problem is that I am not able to populating the bo?

Well, let's dig a little deeper...this is the ONLY way I generally ever populate a combo, so give me some more details or post a quick sample so we can see what you might be doing that is not working for you.  Also, there are quite a few samples throughout the different samples that does this, so you might want to look at these as well.

By Michael Reese - 3/24/2008

Sure,

In a nutshell, when  I update the form, the column value attached to the timespan combo is not being saved? I have a ton of combos enums, and others in the application which are fine. This one is just not getting the timespan value?

Michael

By Trent L. Taylor - 3/24/2008

This one is just not getting the timespan value?

Gothca....so do you have the value member field in the BO coming back as a time span?  You might consider creating a custom property on the BO from which you are populating which returns a TimeSpan value like you are doing in your manual sample, this way you are ensured that it is typed as a TimeSpan.