Results 1 to 6 of 6

Thread: Is MSFlexGrid editable?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    76

    Unhappy Is MSFlexGrid editable?

    hi,
    i m preparing a bill which will be in MSFlexGrid. Actually i have a doubt regarding MSFlexGrid, can entries be made directly in the flexgrid, if yes the are calculations possible inside the grid by givivg an event ex: calculate. Plz guys if u have any dummy code then can u plz send me, it wud of gr8 help.

    wil b eagerly waiting for ur replies


    kaushik

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Is MSFlexGrid editable?

    There is calculate event for the MSFlexGrid, but you can, programmatically, make it editable. Is this what you are after?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    76

    Re: Is MSFlexGrid editable?

    Quote Originally Posted by Hack
    There is calculate event for the MSFlexGrid, but you can, programmatically, make it editable. Is this what you are after?
    Basically wat i m after is instead of writing in textboxes which will programatically enter the data in the grid. Can i directly make entries into the grid???????

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Is MSFlexGrid editable?

    Quote Originally Posted by kaushiks
    Basically wat i m after is instead of writing in textboxes which will programatically enter the data in the grid. Can i directly make entries into the grid???????
    Yes. Try this.
    VB Code:
    1. Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
    2.     With MSFlexGrid1
    3.         Select Case KeyAscii
    4.                
    5.             Case 8: 'backspace
    6.                 If .Text <> "" Then .Text = _
    7.                  Left$(.Text, (Len(.Text) - 1))
    8.             Case 13: 'enter key
    9.                 Select Case .Col
    10.                     Case Is < (.Cols - 1):
    11.                         SendKeys "{right}"
    12.                     Case (.Cols - 1):
    13.                         If (.Row + 1) = .Rows Then
    14.                             .Rows = .Rows + 1
    15.                         End If
    16.                         SendKeys "{home}" + "{down}"
    17.                 End Select
    18.             Case Else
    19.                 .Text = .Text + Chr$(KeyAscii)
    20.                 'write your own keyascii Validations under
    21.                        'commented lines
    22.                 Select Case .Col
    23.                     Case 0, 1, 2:
    24.                         'if (your condition(s)) then
    25.                             'accept only charectors
    26.                         'Else
    27.                         '   keyascii=0
    28.                         'End If
    29.                     Case Else
    30.                 End Select
    31.         End Select
    32.     End With
    33.  
    34. End Sub

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2005
    Posts
    76

    Unhappy Re: Is MSFlexGrid editable?

    Quote Originally Posted by Hack
    Yes. Try this.
    VB Code:
    1. Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
    2.     With MSFlexGrid1
    3.         Select Case KeyAscii
    4.                
    5.             Case 8: 'backspace
    6.                 If .Text <> "" Then .Text = _
    7.                  Left$(.Text, (Len(.Text) - 1))
    8.             Case 13: 'enter key
    9.                 Select Case .Col
    10.                     Case Is < (.Cols - 1):
    11.                         SendKeys "{right}"
    12.                     Case (.Cols - 1):
    13.                         If (.Row + 1) = .Rows Then
    14.                             .Rows = .Rows + 1
    15.                         End If
    16.                         SendKeys "{home}" + "{down}"
    17.                 End Select
    18.             Case Else
    19.                 .Text = .Text + Chr$(KeyAscii)
    20.                 'write your own keyascii Validations under
    21.                        'commented lines
    22.                 Select Case .Col
    23.                     Case 0, 1, 2:
    24.                         'if (your condition(s)) then
    25.                             'accept only charectors
    26.                         'Else
    27.                         '   keyascii=0
    28.                         'End If
    29.                     Case Else
    30.                 End Select
    31.         End Select
    32.     End With
    33.  
    34. End Sub



    Thanx man i think this might work

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Is MSFlexGrid editable?

    Quote Originally Posted by kaushiks
    Thanx man i think this might work
    I honestly don't know how long I've had that piece of code, but it has been quite a while and I've used it many, many times myself.

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