|
-
Apr 16th, 2002, 02:19 AM
#1
Thread Starter
Lively Member
MSHFlexgrid, how can I edit the columns? ***RESOLVED***
I want to edit the columns of this component but don't know how.
Anyone knows?
WiseGuy
Last edited by WiseGuy; May 8th, 2002 at 06:59 AM.
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 02:28 AM
#2
You'll have to create a textbox, without borders.
place it on your form, and set visibility to false.
when the user clicks on the flexgrid,
place the textbox over that particular cell
Here's an example:
Code:
txtflex.Top = flex.Top + flex.CellTop
txtflex.Left = flex.Left + flex.CellLeft
txtflex.Visible = True
txtflex.Text = flex.Text
txtflex.Width = flex.CellWidth
txtflex.Height = flex.CellHeight
I hope you understood this. txtflex is a textbox I've placed, and I've named my flex grid as flex
-
Apr 16th, 2002, 02:29 AM
#3
Addicted Member
Sorry, you cant. check out Microsoft Library. Use the MSFlex Grid
not the MSHFlex Grid, that one is read-only.
If you have any other questions you can e-mail me or post them here.
-
Apr 16th, 2002, 02:32 AM
#4
ok do what jwmoore says, and I forgot to add,
in the txtflex_validate event, that's where you will be making your additions to the flexgrid.
flex.textmatrix(flex.row, flex.col) = txtflex.text
HTH
-
Apr 16th, 2002, 02:35 AM
#5
PowerPoster
hmm, this works ... got if off a thread ... dont remeber from who
but you can edit the msflexgrid ... give it a try
VB Code:
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
With MSFlexGrid1
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
-
Apr 16th, 2002, 02:35 AM
#6
Thread Starter
Lively Member
I'll do what JWmoore says that'll be a lot easier hehe.
Thank you both!
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 02:36 AM
#7
Addicted Member
Sucks when they create a control for data access and you cant update through it. Almost seems useless. It looks nice.
-
Apr 16th, 2002, 02:40 AM
#8
PowerPoster
that code i posted works with MSHFlexgrid too, by the way
-
Apr 16th, 2002, 02:46 AM
#9
Addicted Member
How do you update the data then. This would take alot of coding not sure if its possible.
-
Apr 16th, 2002, 02:46 AM
#10
Thread Starter
Lively Member
Muddy, it looks like that code you provided is for editting in run-time, I just want to edit the columns in build time
And JWMoore I don't see how I could edit the columns of the MSflexgrid either!
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 02:48 AM
#11
Addicted Member
You want to edit the columns at design time? What are you trying to do exactly. Are you trying to load data from a database?
Please explain.
-
Apr 16th, 2002, 02:54 AM
#12
Thread Starter
Lively Member
I'm sorry for not being clear enough, yes I want to edit the columns at designtime. The grid is used to load a lot of data on. But if I can't edit the columns there are a lot of weird names that are automatically generated using the SQL statement I provided.
Here's the code I use (if that's of any help)
VB Code:
Set cn = New ADODB.Connection
cn.ConnectionString = "Data Source=spijsDB;User ID=spijs;Password=spijs;"
cn.Open
Set rs = New ADODB.Recordset
grdDataGrid.Refresh
cn.CursorLocation = adUseClient
strSQL = "select a.artikelID, a.productcode, a.artikelnaam, b.typecode, TO_CHAR(a.tolerantiepluskg), c.celnaam, TO_CHAR(a.natdroogverh) from artikelen a, artikeltype b, cellen c"
rs.Open strSQL, cn
Set grdDataGrid.DataSource = rs
grdDataGrid.Refresh
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 02:54 AM
#13
PowerPoster
Originally posted by jwmoore2001
How do you update the data then. This would take alot of coding not sure if its possible.
just equate mshflexgrid.textmatrix(x,y) to the database fields
binding a datagrid is easier though
some folks seem to hate binding for some reason (havent quite figured out why)
-
Apr 16th, 2002, 02:59 AM
#14
Originally posted by Muddy
just equate mshflexgrid.textmatrix(x,y) to the database fields
binding a datagrid is easier though
some folks seem to hate binding for some reason (havent quite figured out why)
I myself prefer flex grids for the flexibility.
I would also like to know how to add data there at design time. I did not know you could do that, and was under the impression it's not possible.
-
Apr 16th, 2002, 02:59 AM
#15
PowerPoster
Originally posted by WiseGuy
I'm sorry for not being clear enough, yes I want to edit the columns at designtime. The grid is used to load a lot of data on. But if I can't edit the columns there are a lot of weird names that are automatically generated using the SQL statement I provided.
Here's the code I use (if that's of any help)
VB Code:
Set cn = New ADODB.Connection
cn.ConnectionString = "Data Source=spijsDB;User ID=spijs;Password=spijs;"
cn.Open
Set rs = New ADODB.Recordset
grdDataGrid.Refresh
cn.CursorLocation = adUseClient
strSQL = "select a.artikelID, a.productcode, a.artikelnaam, b.typecode, TO_CHAR(a.tolerantiepluskg), c.celnaam, TO_CHAR(a.natdroogverh) from artikelen a, artikeltype b, cellen c"
rs.Open strSQL, cn
Set grdDataGrid.DataSource = rs
grdDataGrid.Refresh
WiseGuy
thats a Datagrid
-
Apr 16th, 2002, 03:01 AM
#16
PowerPoster
Originally posted by mendhak
I myself prefer flex grids for the flexibility.
I would also like to know how to add data there at design time. I did not know you could do that, and was under the impression it's not possible.
Sir Frog,
I dont think you can at design time. im not sure why you would need to do that as you could always load it up when the form loads ...
-
Apr 16th, 2002, 03:02 AM
#17
Thread Starter
Lively Member
thats a Datagrid
no it's not, it's the name of a datagrid.
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 03:03 AM
#18
PowerPoster
Originally posted by WiseGuy
I'm sorry for not being clear enough, yes I want to edit the columns at designtime. The grid is used to load a lot of data on. But if I can't edit the columns there are a lot of weird names that are automatically generated using the SQL statement I provided.
Here's the code I use (if that's of any help)
VB Code:
Set cn = New ADODB.Connection
cn.ConnectionString = "Data Source=spijsDB;User ID=spijs;Password=spijs;"
cn.Open
Set rs = New ADODB.Recordset
grdDataGrid.Refresh
cn.CursorLocation = adUseClient
strSQL = "select a.artikelID, a.productcode, a.artikelnaam, b.typecode, TO_CHAR(a.tolerantiepluskg), c.celnaam, TO_CHAR(a.natdroogverh) from artikelen a, artikeltype b, cellen c"
rs.Open strSQL, cn
Set grdDataGrid.DataSource = rs
grdDataGrid.Refresh
WiseGuy
If you are trying to change the column captions on a Datagrid .. then right click on it (design time) select properties. Filp through the tabs till you find it ...
-
Apr 16th, 2002, 03:04 AM
#19
PowerPoster
Originally posted by WiseGuy
no it's not, it's the name of a datagrid.
WiseGuy
Wiseguy
-
Apr 16th, 2002, 03:07 AM
#20
Thread Starter
Lively Member
Yeah WiseGuy indeed 
but if it would be a simple as you said :
Filp through the tabs till you find it ...
The I would have found it by now but i didn't
b.t.w. this is almost a chatsession LOL
The WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 03:09 AM
#21
You called me sir frog! thanks 
as muddy said, It's not possible. i just tried doing that on my project, I found nothing.
Like I've explained above, with a flexgrid, you load at runtime, and you edit at runtime.
The reason it's called a flexgrid, is because, it's just there. and you just code it's entire working, in your own way. (flexibility)
-
Apr 16th, 2002, 03:11 AM
#22
PowerPoster
-
Apr 16th, 2002, 03:11 AM
#23
Addicted Member
I think it is a chat, right.
Anyway with the datagrid, out of curiosity, why do you want to update the grid at design time?
-
Apr 16th, 2002, 03:11 AM
#24
Thread Starter
Lively Member
Could you give me an example of how to edit a column at runtime?
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 03:17 AM
#25
Originally posted by WiseGuy
Could you give me an example of how to edit a column at runtime?
WiseGuy
Sorry If I sound confused.
edit a column for a datagrid or a flexgrid?
-
Apr 16th, 2002, 03:18 AM
#26
Thread Starter
Lively Member
Dear Mr. Muddy,
I thought I said I wanted to use the Flex grid and not the datagrid!
I know how it is done in a datagrid.
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 03:20 AM
#27
Thread Starter
Lively Member
I'd like an example of how to edit a column of a flexgrid at runtime
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 03:22 AM
#28
PowerPoster
Originally posted by Muddy
If you are trying to change the column captions on a Datagrid .. then right click on it (design time) select properties. Filp through the tabs till you find it ...
Wiseguy
but if it would be a simple as you said :
quote:
--------------------------------------------------------------------------------
Filp through the tabs till you find it ...
--------------------------------------------------------------------------------
The I would have found it by now but i didn't
-
Apr 16th, 2002, 03:25 AM
#29
I thought I showed you...
go back and look at my post at the beginning of this thread.
that's how you get the textbox in place.
to do the editing, in the texbox validate event,
Code:
private sub txtflex_validate()
flex.textmatrix(flex.row, flex.col) = txtflex.text
end sub
one more question.
are you trying to connect to a database? in that case, it would be different.
sorry if we are confusing you.
-
Apr 16th, 2002, 03:26 AM
#30
PowerPoster
Originally posted by WiseGuy
I'd like an example of how to edit a column of a flexgrid at runtime
WiseGuy
VB Code:
MSFlexGrid1.TextMatrix(0, 1) = 999
-
Apr 16th, 2002, 03:28 AM
#31
Addicted Member
I think he's getting frustrated. He did say he knows how to modify column fields in a DataGrid at design time. It's not possible to modify the FlexGrid Columns at design time.
I figured out, how to add a row, but not a column. Still working on it. This is at run-time for a MSHflexgrid.
-
Apr 16th, 2002, 03:31 AM
#32
Thread Starter
Lively Member
Well I'm not getting frustrated
It's just that it's all a bit confusing because it's going all so fast
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 03:31 AM
#33
PowerPoster
if yu just want to type it in to edit it at run time ... see the code i posted above (5th post in this thread). it works for msflexgrid OR mshflexgrid
-
Apr 16th, 2002, 03:33 AM
#34
ok... try whatever we've given you here.
then relax, come back here, and tell us if you run into problems.
-
Apr 16th, 2002, 03:34 AM
#35
Addicted Member
Muddy is right. You can edit the flex grid with that code from above. Using the textmatrix is the only way your going to be able to modify any of the cells (including headers) and only at run-time.
-
Apr 16th, 2002, 03:40 AM
#36
Thread Starter
Lively Member
No forget the run-time for a moment, I'm just talking about designtime for now, okey.
Here's the situation again:
I'm connecting to an Oracle DB and I want to show a lot of data in the grid. Preferebly an msFlexgrid or an MSHFlexgrid.
The problem is, that if I don't do anything with the columnheaders the I get weird names.
I want to give my own names to the column headers so that it looks a bit better.
I hope that this will clear out some questionmarks
The WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
-
Apr 16th, 2002, 03:43 AM
#37
PowerPoster
I'm not sure if this works after you have bound the grid, but give it a shot:
MSFlexGrid1.TextMatrix(0, 1) = "Column 1 Header"
Other than that I am out of ideas.
Good Luck!
-
Apr 16th, 2002, 03:52 AM
#38
Originally posted by Muddy
I'm not sure if this works after you have bound the grid, but give it a shot:
MSFlexGrid1.TextMatrix(0, 1) = "Column 1 Header"
Other than that I am out of ideas.
Good Luck!
Muddy, how can you bind the flexgrid at runtime? You are confusing me as well
-
Apr 16th, 2002, 03:53 AM
#39
I mean
how can you bind a flexgrid.
(forget the runtime part)
-
Apr 16th, 2002, 03:54 AM
#40
Thread Starter
Lively Member
Muddy code does work, I'm just trying to find out when to trigger the code :S
WiseGuy
I stuck my head out of the window and got arrested for mooning!
This Post is sponsored by my PC: PIII900, 512MBDimm/133, Seagate 40GB/7200 ATA100, LiteOn 12x DVD, Lite-On 32x12x40 CDrw, Elsa Geforce2 Ultra 64MB incl tv-out, SoundBlaster Live 1024, Ilyama A702HT Vision Master Pro410 17".
O/S: Windows XP Professional (dutch)
Internet: Cable (1Mbit connection)
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
|