Question

How to store the idnum from my database to combobox so i can edit and update the records.
I don't have any idea this is my first time using foxpro.

my database name is emp4win.
i need to get the idnum and store to combobox for editing
i tried this one
Form1.lstMyList.RowSourceType = 2
Form1.lstMyList.RowSource = "emp4win"

No correct solution

OTHER TIPS

Make sure the table is opened first before the code executes.Check this http://msdn.microsoft.com/en-us/library/ykwzk7h2(v=vs.80).aspx

Although the answer from NullReferenceException is an ok start, I didn't see reference to what would really help you with respect to binding for the IDs. The properties of the combobox I would work with are

RowSource = "tableNameThatHasTheRecords"

&& Dropdown list only allows those values in the table as valid
&& Dropdown COMBO allows the list OR manually entered values, but you have to deal with what if the entered value is not in the table... add it or what.
Style = 2  && List
Style = 0  && Combo

&& Fields.  You want to display values from the columns in your table
RowSourceType = 6


&& Columns in the order you want displayed.  However, if dealing with an "ID" Column that you don't necessarily want to show the user, this would typically be put LAST in the list of columns presented
RowSource = "ColumnX, ColumnY, IDColumn"


&& ColumnWidths is how wide you want each column when the drop-down is exposed.  The first column is always shown in the combobox, but when in drop-down mode, will show all 3 columns possible, but since this example has the third column width of 0, it will NOT actually show the column value.  (such as internal auto-increment ID that would otherwise mean nothing to the end-user).
ColumnWidths = "160, 85, 0"

&& How many columns in the row source that you have specifically made available
ColumnCount = 3  

&& BOUND COLUMN is the key one for you.  Which column of the row source do you want the value returned to the control's ".Value".  In this case, column 3, the ID column even though the display width is zero, it will still put the ID as the selected value
BoundColumn = 3
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top