473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Regarding Flexgrid

13
Hi all,
I would like to add a new row to MS felx grid when i press enter key in particular row at runtime...Is it possible?? Is anyother control available in VB to do this?please reply....
Jun 9 '07 #1
2 1408
pureenhanoi
175 100+
not a good idea using a tradition MS Flex grid to make an editable table. Because MS Flex grid does not support editing directly. U cannot press any key to insert characters into cells like Excel. Some advance versions of Flex Grid (like Video Soft VSFlex Grid) support Editable property, so u can edit cell dirrectly. But your question here is about inserting a new row into Flex Gird, so can u try this code
Expand|Select|Wrap|Line Numbers
  1. Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
  2. If KeyAscii = vbKeyReturn Then     ' if u press Enter 
  3.     If MSFlexGrid1.Row = MSFlexGrid1.Rows -1 then    'current row is last row of grid
  4.         MSFlexGrid1.AddItem ""            'insert a new blank row
  5.         MSFlexGrid1.Row = MSFlexGrid1.Row +1           'move curso to new row
  6.         MSFlexGrid1.Col = 1                                          'at the first column
  7. End If
  8. End Sub
  9.  
this example will work well if your flex grid have one fixed row and one fixed column
Jun 9 '07 #2
kalps
13
not a good idea using a tradition MS Flex grid to make an editable table. Because MS Flex grid does not support editing directly. U cannot press any key to insert characters into cells like Excel. Some advance versions of Flex Grid (like Video Soft VSFlex Grid) support Editable property, so u can edit cell dirrectly. But your question here is about inserting a new row into Flex Gird, so can u try this code
Expand|Select|Wrap|Line Numbers
  1. Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
  2. If KeyAscii = vbKeyReturn Then     ' if u press Enter 
  3.     If MSFlexGrid1.Row = MSFlexGrid1.Rows -1 then    'current row is last row of grid
  4.         MSFlexGrid1.AddItem ""            'insert a new blank row
  5.         MSFlexGrid1.Row = MSFlexGrid1.Row +1           'move curso to new row
  6.         MSFlexGrid1.Col = 1                                          'at the first column
  7. End If
  8. End Sub
  9.  
this example will work well if your flex grid have one fixed row and one fixed column
[quote]
Thanks for ur suggestion..its working. but if i try to enter values to flexgrid at run time it is not working...what i did is , i have written code to enter values to flexgrid at run time and embed the code which u gave with it...while running it is able to get values but if i press enter key on row1 and col 1 it is not producing a new row....
Jul 3 '07 #3

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

Similar topics

7
by: tombsy | last post by:
Hi gang... I want to have a form that can display data from a datasource that is not fixed. lets say a crosstab query that can change the number of colums and field headings depending on the...
4
by: VR | last post by:
I am trying to embed a check box into a FlexGrid's cell, but having a problem when I start scrolling the grid. Here is my MyCheckBox class... class MyCheckBox : CheckBox { void Init (...
9
by: JFB | last post by:
Hi All, I have a edit flexgrid, after to fill with different rows manually. How can I insert the rows of my flexgrid to my table (sql server) using ado.net? Any example? I can insert one row...
0
by: Xavier Valdés | last post by:
Hi all, I'm using component one's flexgrid (nonclassic) and I have a question... How could I drag and drop ROWS??? (from a component with my flexgrid and another component with flexgrid)...
3
by: Xavier Valdés | last post by:
Hi all, I'm using component one's flexgrid (nonclassic) and I have a question... How could I drag and drop ROWS??? (from a component with my flexgrid and another component with flexgrid)...
4
by: fripper | last post by:
I have replaced an older machine with a new one and have moved a VB .Net program that I worte on the old machine to the new one. The program uses a FlexGrid control for displaying some stuff in a...
5
by: schapopa | last post by:
I have a flex grid and I am loading data to this flex grid in this way While sqldr.Read j = j + 1 MSFlexGrid1PLSummary.set_TextMatrix(MSFlexGrid1PLSummary.Row, MSFlexGrid1PLSummary.Col,...
0
by: alexh1000 | last post by:
When I insert the FlexGrid control in a dialog (using controls toolbar) the dialog fails to open on program execution(DoModal returns a -1). If I remove the FlexGrid from the dialog, the dialog...
3
by: sweevil | last post by:
I'm converting a VB6 project to .Net2005. One of the items encountered was setting the cellpicture onto a flexgrid from an imagelist. The image background doesn't appear to render correctly. I...
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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...

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.