Re: combobox,rowsource,displayvalue,controlsource



Hi,

I've marked with an ** which code i've added.
Then you'll see the behaviour I don't want.
I just add a combobox controlsource with a table.

PUBLIC oform1
CREATE CURSOR "test" (nummer C(10)) **
APPEND BLANK **
oform1=NEWOBJECT("form1")
oform1.Show()
RETURN
DEFINE CLASS form1 AS form
ADD OBJECT combo1 AS combobox WITH ;
boundto = .t.,; **
controlsource = "test.nummer",; **
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

--
Christophe Steyaert
Int. Repair Services Zeebrugge
L. Blondeellaan 5
8380 Zeebrugge
tel : 050 54 20 27
fax : 050 54 79 84
"Stefan Wuebbe" <stefan.wuebbe@xxxxxx> schreef in bericht
news:u4LJDOunIHA.2328@xxxxxxxxxxxxxxxxxxxxxxx

"christophe" <nothingtosend@xxxxxxxxx> schrieb im Newsbeitrag
news:ORbPmjtnIHA.4196@xxxxxxxxxxxxxxxxxxxxxxx
Stefan,

I have put this code in the combo.valid()

IF .not. seek(this.DisplayValue,"rowsourcetable")
INSERT INTO "rowsourcetable" (klantnr) VALUES (this.displayvalue)
this.Requery()
ENDIF

but still it is blanked when leaving the combobox.
Although the rowsource is correct.

The example.prg below works for me, same for you?
If so, can you modify it to match your requirements and make it
reproduce the misbehaviour you observed?


hth
-Stefan



*
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show()
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
*



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------



.



Relevant Pages

  • Re: combobox,rowsource,displayvalue,controlsource
    ... Although the rowsource is correct. ... ADD OBJECT combo1 AS combobox WITH; ... CREATE CURSOR temp ) ... LOCAL lcValue ...
    (microsoft.public.fox.programmer.exchange)
  • Re: vb6 multicol combo
    ... I have trying to load data into combobox by using ... i am not sure why does it gives me error that invalid procedure or call? ... The combobox that ships with VB has no support, at all, for multiple ... .ItemData= temp ...
    (microsoft.public.vb.general.discussion)
  • Entries of ComboBox with Color
    ... So looking at the archives, it seems like only the entire line entry ... "TEMP ■" where the square block after temp is either red or blue... ... Is there a way to have it be red or blue within the ComboBox? ...
    (microsoft.public.excel.misc)
  • vb6 multicol combo
    ... I have trying to load data into combobox by using ... temp = rs!id ... i am not sure why does it gives me error that invalid procedure or call? ...
    (microsoft.public.vb.general.discussion)

Loading