Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid and a combo box
Message
From
12/08/2003 03:43:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/08/2003 15:17:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00819101
Message ID:
00819266
Views:
9
>Ok i have a grid. All the column of the grid is linked with a field of a table. I want to give the choice between yes and no in a combobox inside the grid. But if i link this column i loose all my data entered by hand .how can i do

I'm not sure I understood exactly.
You don't want to use an available field in grid recordsource for this ? Then use a cursor and set column's controlsource to cursor's field. For just entering a Yes,No I think combo is somewhat a luxury. You might do but a simple 'M' format with ',Yes,No' values would do. ie:
oForm = Createobject('myForm')
oForm.Show
Read Events


Define Class myForm As Form
  DataSession = 2
  Top = 0
  Left = 0
  Height = 300
  Width = 500
  DoCreate = .T.
  Caption = "Form1"
  Name = "Form1"


  Add Object grdcustomer As Grid With ;
    ColumnCount = 4, ;
    Height = 250, ;
    Left = 40, ;
    RecordSource = "customer", ;
    RecordSourceType = 1, ;
    Top = 10, ;
    Width = 420, ;
    Name = "grdCustomer"

  Add Object myButton As CommandButton With ;
    Left = 10, Top = 270, Caption = 'Show'


  Procedure Init
    With This.grdcustomer
      With .Column1
        .ControlSource = "customer.cust_id"
        .Header1.Caption = 'customer ID'
      Endwith
      With .Column2
        .ControlSource = "customer.company"
        .Header1.Caption = 'Company'
      Endwith
      With .Column3
        .ControlSource = "customer.contact"
        .Header1.Caption = "Contact"
      Endwith
      With .Column4
        .ControlSource = "crsYesno.Yesno"
        .Format = "M"
        .InputMask = ",Yes,No"
        .Header1.Caption = "YesNo"
      Endwith
    Endwith
  Endproc

  Procedure Load
    Select Cust_id, Space(3) As YesNo From customer Into Cursor crsYesno Readwrite
    Select customer
    Set Relation To Recno() Into crsYesno
    locate
  Endproc
  Procedure QueryUnload
    Clear Events
  Endproc
  Procedure myButton.Click
    Select a.Cust_id, a.Company, b.YesNo ;
      from customer a ;
      inner Join crsYesno b On a.Cust_id = b.Cust_id
  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