473,478 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MSFlexGrid Cell Editing

63 New Member
Hey, how can I allow the user to edit ANY cell from any row and column in an msflexgrid ? I found the following code, but it only allows input for the first column. Thank you in advance.

Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)

Dim sTemp As String

With MSFlexGrid1

sTemp = .TextMatrix(.row, .Col)

Select Case KeyAscii
Case 8 ' backspace
If Len(sTemp) > 0 Then
sTemp = Left$(sTemp, Len(sTemp) - 1)
End If
Case 27 ' escape
sTemp = ""
Case 0 To 31
KeyAscii = 0
Case Else
sTemp = sTemp & Chr$(KeyAscii)
End Select
.TextMatrix(.row, .Col) = sTemp
End With

End Sub
Mar 9 '08 #1
2 7857
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

For "Enter" key press, you need to move on to new cell..
Roughly like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
  2.  
  3. Dim sTemp As String
  4.  
  5. With MSFlexGrid1
  6.  
  7. sTemp = .TextMatrix(.row, .Col)
  8.  
  9. Select Case KeyAscii
  10. Case 13  'Enter Key
  11.  .TextMatrix(.Row, .Col  ) =sTemp
  12.   If .Col = .Cols-1 Then
  13.       If .Row = .Rows - 1 Then
  14.          sTemp = ""
  15.          Exit Sub
  16.       Else
  17.           .Row = .Row +1
  18.           .Col = 1 'Make this zero if First Col also is edittable
  19.          sTemp = .TextMatrix(.row, .Col)
  20.       End If
  21.   Else
  22.       .Col = .Col + 1
  23.          sTemp = .TextMatrix(.row, .Col)
  24.   End If
  25. Case 8 ' backspace
  26. If Len(sTemp) > 0 Then
  27. sTemp = Left$(sTemp, Len(sTemp) - 1)
  28. End If
  29. Case 27 ' escape
  30. sTemp = ""
  31. Case 0 To 31
  32. KeyAscii = 0
  33. Case Else
  34. sTemp = sTemp & Chr$(KeyAscii)
  35. End Select
  36. .TextMatrix(.row, .Col) = sTemp
  37. End With
  38.  
  39. End Sub
  40.  
Regards
Veena
Mar 10 '08 #2
realwish
1 New Member
How Can We Send Data From Msflexgrid To The Msaccess[img]
Mar 17 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3499
by: mefloyd | last post by:
Hello, I'd like to outline the current cell in an MSFlexGrid control with a certain color and line thickness. I thought of putting a shape control on the form and positioning it over the cell,...
1
789
by: Julia Sats | last post by:
Hi, This question about MSFlexGrid from VB6 but maybe anybody here can help me: I need to select cell from grid. If I select any cell from not headers part - everything fine. But if I select...
1
4897
by: Mad Scientist Jr | last post by:
can someone explain how to simply populate a grid in .net ? the way i understand it, there is no more msflexgrid, and instead is this new control that has to be tied to a dataset, and it is a real...
5
4413
by: Sharon | last post by:
I have a DataGrid on my Form, and I wish to disable any cell editing. For example; when the user clicks on a cell, the cell become editable by changing its color to gray and context menu is shown...
0
6887
by: bemanian | last post by:
Hi, This is a simple DataGridView in a windows form which contains a number of other controls as buttons, text boxes and so on. The problem is when the data grid cell editing is conducted via...
3
2740
by: WhiteShore | last post by:
Just another msflexgrid's topic.. does anyone know how to validate the cell from msflexgrid? for example i want to validate the column(3) if it's not numeric (after editing) then it would...
1
2197
by: MiziaQ | last post by:
Hey, how can I change the background color of a cell in MSFlexGrid ? Thanks in advance, MiziaQ
0
1083
nirmalsingh
by: nirmalsingh | last post by:
hai all, what is the maximum no of characters can be placed in msflexgrid cell? is there any constraint? thanx in advance with love Nirmal
0
2180
by: priyamtheone | last post by:
I have a datagridview with a button column as one of its column collection. The width of the button column is say 50 but the problem is the button editing control within the cell of that column is...
0
6899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7019
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6719
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6847
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4757
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4463
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.