LOCAL nCnt
FOR nCnt = 1 TO thisform.cboCourse.ListCount
IF thisform.cboCourse.List(nCnt) = ALLTRIM(a_Courses.CourseName)
thisform.cboCourse.Selected(nCnt) = .t.
ENDIF
ENDFOR
But selected item is not apearing on top of the combo's list.
LOCAL nCnt
FOR nCnt = 1 TO thisform.cboCourse.ListCount
IF thisform.cboCourse.List(nCnt) = ALLTRIM(a_Courses.CourseName)
thisform.cboCourse.Selected(nCnt) = .t.
ENDIF
ENDFOR
But selected item is not apearing on top of the combo's list.
You're doing something really strange. Please list all the properties for your combobox. Is it bound (e.g. does it have a ControlSource) If yes, then the correct value should automatically appear.
You can also always try thisform.ComboBox.ListIndex = 1 to select the first item in the list.
Ahsan Amin wrote:
LOCAL nCnt
FOR nCnt = 1 TO thisform.cboCourse.ListCount
IF thisform.cboCourse.List(nCnt) = ALLTRIM(a_Courses.CourseName)
thisform.cboCourse.Selected(nCnt) = .t.
ENDIF
ENDFORBut selected item is not apearing on top of the combo's list.
I bet this code is in the Init() of your form. If so, this is a known bug and is documented in the knowledge base:
Set the combo's ListIndex to 1 instead
PSS ID Number: 177340
Article Last Modified on 12/11/1999
yes this code is written in form's Init event and i set it's control source on run time and other like
BoundColumn = 1
RowSource = a_courses.coursename
RowSourceType = 6 - Type
in property window. I have not set it's ListIndex propery yet.
yes this code is written in form's Init event and i set it's control source on run time and other like
BoundColumn = 1
RowSource = a_courses.coursename
RowSourceType = 6 - Type
in property window. I have not set it's ListIndex