|
-
Nov 12th, 2001, 05:17 PM
#1
Thread Starter
Fanatic Member
MSFlexgrid
Dumb question but I can't quite figure it out. How do I set things so that when I click on a cell in MSFlexgrid I can
1) edit it
2) detect changes
 Looking for a friendly intelligent chat forum? Visit the white-hart.net 
-
Nov 12th, 2001, 05:19 PM
#2
PowerPoster
Well
Edit it?
Simple version...
Me.text1.text = me.msflexgrid1.textmatrix(me.msflexgrid1.rowsel,me.msflexgrid1.colsel)
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Nov 12th, 2001, 05:30 PM
#3
if you want to edit a cell (like it was atextbox) then search vbworld for
'flexgrid' you will find the code to pulldown a textbox over a cell
-
Nov 12th, 2001, 05:43 PM
#4
Thread Starter
Fanatic Member
I just want to enter numbers and text in the cells just as I would with an excel sheet and trigger an event so that can save them as I go. I searched before I posted and couldn't find anything suitable.
 Looking for a friendly intelligent chat forum? Visit the white-hart.net 
-
Nov 13th, 2001, 02:40 AM
#5
yes i found code
search this forum for 'msflexgrid'
it gives you the reference in MSDN
both code examples are poor, and dont do what I want...
I am going to troll the net for a better control.. will reply later if
i find anything
-
Nov 13th, 2001, 05:21 AM
#6
Thread Starter
Fanatic Member
Ok I found this http://support.microsoft.com/support.../Q241/3/55.ASP on MSDN but it seems very cumbersome. Anyone got any idea how to trigger an event just by clicking on a cell?
 Looking for a friendly intelligent chat forum? Visit the white-hart.net 
-
Nov 13th, 2001, 05:57 AM
#7
Thread Starter
Fanatic Member
One line answer
This does it
MSFlexGrid1.Text = InputBox("Enter new value", ,MSFlexGrid1.Text)
 Looking for a friendly intelligent chat forum? Visit the white-hart.net 
-
Nov 13th, 2001, 07:29 AM
#8
Try this:
VB Code:
'===================================================
'Put this code in MSFlexGrid Keypress Event
'===================================================
Private Sub MSFlexGrid_KeyPress(KeyAscii As Integer)
With MSFlexGrid
Select Case KeyAscii
Case 8: 'IF KEY IS BACKSPACE THEN
If .Text <> "" Then .Text = _
Left$(.Text, (Len(.Text) - 1))
Case 13: 'IF KEY IS ENTER THEN
Select Case .Col
Case Is < (.Cols - 1):
SendKeys "{right}"
Case (.Cols - 1):
If (.Row + 1) = .Rows Then
.Rows = .Rows + 1
End If
SendKeys "{home}" + "{down}"
End Select
Case Else
.Text = .Text + Chr$(KeyAscii)
'write your own keyascii Validations under
'commented lines
Select Case .Col
Case 0, 1, 2:
'if (your condition(s)) then
'accept only charectors
'Else
' keyascii=0
'End If
Case Else:
End Select
End Select
End With
End Sub
-
Nov 13th, 2001, 09:18 AM
#9
Thread Starter
Fanatic Member
It works- very clever - actually cleverer and more to the point than the MSDN example!
 Looking for a friendly intelligent chat forum? Visit the white-hart.net 
-
Nov 13th, 2001, 09:19 AM
#10
Thread Starter
Fanatic Member
 Looking for a friendly intelligent chat forum? Visit the white-hart.net 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|