Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Relating Combo Boxes
Message
From
19/08/2004 06:24:39
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00934146
Message ID:
00934435
Views:
28
This message has been marked as the solution to the initial question of the thread.
>Thankyou Cetin,
>
>When I put this syntax into form init I get an error 'unrecognised command verb'. What does this mean?
>
>
>SET EXCLUSIVE OFF
>SET DEFAULT TO ("C:\Foxpro Projects\Statistics")
>
>with thisform.combo1
> .RowSourcetype = 3
> .Rowsource = 'Select distinct type from products into cursor crsproduct'
> .ColumnCount = 1
> .displayvalue='Select Product Group'
>ENDWITH
>
>with this.combo2
> .RowSourcetype = 3
> .Rowsource = 'Select subtype from products where type=crsproduct.type into cursor crssubtype'
> .ColumnCount = 1
> .displayvalue='Select Product Type'
>ENDWITH
>
>
>Many Thanks
>
>My Table called products has 2 fields namely Type and Subtype. I have 5 records in there:
>
>
>Type                Subtype
>
>Trouser             Slimleg
>Trouser             Kickflare
>Trouser             Bootleg
>Jacket              Double Breasted
>Jacket              Single Breasted
>
I don't see something that'd cause error there, must be something else. Note that in below code combo1, combo2 codes are exactly same as yours :
Public oForm
oForm = Createobject('myForm')
oForm.Show

Define Class myForm As Form
  Add Object combo1 As ComboBox With ;
    Height = 24, Left = 17, Top = 27, Width = 131
  Add Object combo2 As ComboBox With ;
    Height = 24, Left = 161, Top = 27, Width = 131
  Add Object label1 As Label With ;
    Caption = "Type", Height = 17, Left = 17, Top = 10, Width = 40
  Add Object label2 As Label With ;
    Caption = "SubType", Height = 17, Left = 163, Top = 10, Width = 51

  Procedure Load
TEXT to m.MyText noshow
Trouser             Slimleg
Trouser             Kickflare
Trouser             Bootleg
Jacket              Double Breasted
Jacket              Single Breasted
ENDTEXT
    lcTemp = Sys(2015)+'.txt'
    Strtofile(m.MyText,m.lcTemp)

    lnTypeLen = Len('Trouser             ')
    Create Cursor Products (Type c(m.lnTypeLen),SubType c(30))
    Append From (m.lcTemp) Type Sdf
    Erase (m.lcTemp)
  Endproc

  Procedure Init
    With This.combo1
      .RowSourceType = 3
      .RowSource = 'Select distinct type from products into cursor crsproduct'
      .ColumnCount = 1
      .DisplayValue='Select Product Group'
    Endwith

    With This.combo2
      .RowSourceType = 3
      .RowSource = 'Select subtype from products where type=crsproduct.type into cursor crssubtype'
      .ColumnCount = 1
      .DisplayValue='Select Product Type'
    Endwith
  Endproc

  Procedure combo1.InteractiveChange
    With This.Parent.combo2
      .Requery()
      .ListIndex=0
      .DisplayValue = 'Select Product Type'
    Endwith
  Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform