> > Hi Experts,
> >
> > I had a combo box in visual foxpro with a Style - 0 Dropdown combo.
> > When I run my form and I type something in the combo box. I lost the data before I went through the Valid event of the combobox.
> >
> > My objective is when I type something in the combobox without pressing the arrow button it will prompt me that my inputs are not in the list???
> >
>
> Hi Rino -
>
> When the value is not in combo.RowSource yet, you may need to add it, at least temporarily.
> (You can add a MessageBox() in combo.Valid() in the example.prg below).
>
>
> hth
> -Stefan
>
>
>
> LOCAL loForm
> loForm=NEWOBJECT("form1")
> loForm.Show(1)
> RETURN
>
> DEFINE CLASS form1 AS form
> ADD OBJECT combo1 AS combobox WITH ;
> RowSourceType = 3, ;
> RowSource = "select * from temp into cursor (sys(2015))", ;
> Height = 24, ;
> Left = 72, ;
> Top = 60, ;
> Width = 100
>
> ADD OBJECT text1 AS textbox WITH ;
> Height = 23, ;
> Left = 156, ;
> Top = 156, ;
> Width = 100, ;
> Value = 'focus dummy'
>
> PROCEDURE Load
> LOCAL lnSelect
> lnSelect = SELECT(0)
> CREATE CURSOR temp (test C(10))
> INDEX on test TAG test
> FOR i = 1 TO 3
> INSERT INTO temp VALUES (TRANSFORM(i))
> ENDFOR
> GO TOP
> SELECT (m.lnSelect)
> ENDPROC
>
> PROCEDURE combo1.Valid
> LOCAL lcValue
> lcValue = TRIM(This.DisplayValue)
> IF !EMPTY(m.lcValue) AND !INDEXSEEK(m.lcValue,.F.,'temp','test')
> INSERT INTO temp VALUES (m.lcValue)
> This.Requery()
> ENDIF
> ENDPROC
> ENDDEFINE
>
Hi Stefan,
Thanks you very much...
Rino