Results 1 to 5 of 5

Thread: Problem in Msflexgrid

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    169

    Problem in Msflexgrid

    Hello friends,

    I have a form that contains,

    Item name------Combo box.
    Msflex grid for Item name,qty.

    If I select an item name from combo box,that name will be displayed in the
    flexgrid first column Item name.Only I have to enter the qty.

    If I enter 3 item names and qty like

    Item name Qty

    A 1
    B 2
    C 2

    If I want to change the item from B to D,error comes.it shows "Enter qty"
    It is not changing.How to clear the entire row details and enter a new item
    My code:
    VB Code:
    1. Private Sub cbomname_KeyPress(KeyAscii As Integer)
    2.     On Error Resume Next
    3.     If KeyAscii = 13 Then
    4.     If c <> 2 Then
    5.         If rec.State > 0 Then rec.Close
    6.         rec.open "select * from Materials where code='" & cbomname.Text & "'", conn
    7.                Text1.SetFocus
    8.         Text1.Text = cbomname.Text
    9.         c = c + 1
    10.         MSFlexGrid1.Col = MSFlexGrid1.Col + 1 Mod MSFlexGrid1.cols
    11.     Else: MsgBox "Error, Enter quantity.", vbExclamation, "Items"
    12. End If
    13. End If
    14. End Sub
    15.  
    16. Private Sub Text1_KeyPress(KeyAscii As Integer)
    17.     On Error Resume Next
    18.     If KeyAscii = 13 Then
    19. If c = 2 Then
    20.            
    21.                 r = r + 1
    22.                 MSFlexGrid1.rows = r
    23.                 MSFlexGrid1.Col = 0
    24.                 MSFlexGrid1.Row = i
    25.                 MSFlexGrid1.Col = MSFlexGrid1.Col + 1 Mod MSFlexGrid1.cols
    26.                 Text1.SetFocus
    27.                 MSFlexGrid1.TextMatrix(i + 1, Col) = r - 1
    28.                 c = 1
    29.                 i = i + 1
    30.                 MSFlexGrid1.Row = MSFlexGrid1.Row + 1 Mod MSFlexGrid1.rows
    31.                  cbomname.SetFocus
    32.             End If
    33.             q = i
    34.             q = q - 1
    35. end if

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    169

    Re: Problem in Msflexgrid

    How to highlight the selected row in flex grid and clear the contents.

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Problem in Msflexgrid


  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2006
    Posts
    169

    Re: Problem in Msflexgrid

    Thanks.

    When I change the selected item,it gives error "Enter qty" without selecting the item!

  5. #5
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Problem in Msflexgrid

    Upload a Zip copy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width