DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Double click DBGrid event,data will appear on another form

  1. #1
    Join Date
    Jul 2009
    Location
    Malaysia
    Posts
    49

    Question Double click DBGrid event,data will appear on another form

    Hi friends, refer to attachment file, if I double click the form1 datagrib the PLU,description and price will appear on form2 text1.text,text2.text and text3.text, how to write this code on dbgrib1.dblclick event ?

    i connect my database using data control.

    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2009
    Location
    Italy - Breganze (VI)
    Posts
    120
    In DataGrid you must load the primary-key, keep hidden this column.

    When user double-click on row, you read the value of primary-key (i.e. IDCustomer) then load record in external Form1.

    Of coure, in Form1 you must have a method (that request the record ID as parameter), to load the record into Form1 controls.

    A short sample:

    In DataGrid1_DoubleClick() event:

    Code:
    Dim ID As Long
    ID = DataGrid1.Columns("IDCustomer").Value
    
    Dim myForm As Form1
    Set myForm = New Form1
    Load myForm
    If myForm.LoadRecord(ID) = True Then
        myForm.Show vbModal
    Else
        MsgBox "Record not found.", vbInformation
        UnLoad myForm
    End If
    Set myForm = Nothing

  3. #3
    Join Date
    Jul 2009
    Location
    Malaysia
    Posts
    49
    got error in this line:if myForm.LoadRecord(ID) = true then
    compile error : method or data member not found

  4. #4
    Join Date
    Mar 2009
    Location
    Italy - Breganze (VI)
    Posts
    120
    Quote Originally Posted by hwkong1688 View Post
    got error in this line:if myForm.LoadRecord(ID) = true then
    compile error : method or data member not found
    Read better my post.
    I written:

    Of coure, in Form1 you must have a method (that request the record ID as parameter), to load the record into Form1 controls.


  5. #5
    Join Date
    Jul 2009
    Location
    Malaysia
    Posts
    49
    gibra, can you provided simple example for my refence,i really no idea how to write
    (e.g: data in form1 datagrid1,if i double click data will appear on form2 text1.text)
    your help is high appreciated

  6. #6
    Join Date
    Mar 2009
    Location
    Italy - Breganze (VI)
    Posts
    120
    Sorry, I can't, because this involve many aspects related to
    'how you load data into controls' ?

    I use classes to load data from table, what technique you use?
    Classes? Binding? Code? ...

    You should create your LoadRecord() method using the code that normally you use to load data into controls.


  7. #7
    Join Date
    Jul 2009
    Location
    Malaysia
    Posts
    49
    Thank you gibra,i know already..

Similar Threads

  1. Replies: 17
    Last Post: 12-19-2007, 01:05 PM
  2. Replies: 0
    Last Post: 01-17-2007, 11:38 PM
  3. Beginner: need help
    By Armand in forum Java
    Replies: 2
    Last Post: 08-06-2003, 03:46 AM
  4. Double Click on TreeNode
    By Arjun Sen in forum Java
    Replies: 0
    Last Post: 12-30-2001, 02:35 PM
  5. Double Text 1.0
    By George Gilbert in forum vb.announcements
    Replies: 0
    Last Post: 08-19-2001, 11:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center