473,394 Members | 1,748 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,394 software developers and data experts.

Clearing MSHFlexgrid's data

39
Hi,
I have a minor trouble in my program. I've one MSHFlexgrid to show all datas from an input form that I made. The problem occurs when I deleted one or more rows in the MSHFlexgrid and would like to add a new data in that MSHFlexgrid. Example: I have 3 rows of data in the MSHFlexgrid, I deleted them all. The deleted datas were gone just fine, but when I entered a new one, MSHFlexgrid shows it in row 4 instead of row 1 (row 1 to 3 are blank). How to make MSHFlexgrid's Row Index back to first row after I deleted the data?

With MSHFlexGrid1
.Clear
.Refresh
End With
(I think I missed something here)

Thank you for your help!
Nairda
Jun 8 '07 #1
4 6292
Dököll
2,364 Expert 2GB
Hi,
I have a minor trouble in my program. I've one MSHFlexgrid to show all datas from an input form that I made. The problem occurs when I deleted one or more rows in the MSHFlexgrid and would like to add a new data in that MSHFlexgrid. Example: I have 3 rows of data in the MSHFlexgrid, I deleted them all. The deleted datas were gone just fine, but when I entered a new one, MSHFlexgrid shows it in row 4 instead of row 1 (row 1 to 3 are blank). How to make MSHFlexgrid's Row Index back to first row after I deleted the data?
Expand|Select|Wrap|Line Numbers
  1.     With MSHFlexGrid1
  2.            .Clear
  3.            .Refresh
  4.     End With
  5.  
(I think I missed something here)

Thank you for your help!
Nairda
How's this:

Expand|Select|Wrap|Line Numbers
  1. Dim NombreID As Integer
  2. Dim GrinSQL As String
  3. Dim fieldsDelete As New ADODB.Recordset 
  4.    NombreID = CInt(mFlex.TextMatrix(mFlex.Row, 5)) '  
  5.    GrinSQL = "select * from YourTableName where id = " + CStr(NombreID)     
  6.    Call fieldsDelete.Open(GrinSQL, cn, 2, 3)    
  7.    fieldsDelete.Delete    
  8.    fieldsDelete.Close    
  9.    Set fieldsDelete = Nothing 
  10.  
I am not sure how many columns you have. Aboce shoudl help handle 5 columns NombreID = CInt(mFlex.TextMatrix(mFlex.Row, 5)) '

Give this a whirl, and see what works...
Jun 8 '07 #2
nairda
39
How's this:

Expand|Select|Wrap|Line Numbers
  1. Dim NombreID As Integer
  2. Dim GrinSQL As String
  3. Dim fieldsDelete As New ADODB.Recordset 
  4.    NombreID = CInt(mFlex.TextMatrix(mFlex.Row, 5)) '  
  5.    GrinSQL = "select * from YourTableName where id = " + CStr(NombreID)     
  6.    Call fieldsDelete.Open(GrinSQL, cn, 2, 3)    
  7.    fieldsDelete.Delete    
  8.    fieldsDelete.Close    
  9.    Set fieldsDelete = Nothing 
  10.  
I am not sure how many columns you have. Aboce shoudl help handle 5 columns NombreID = CInt(mFlex.TextMatrix(mFlex.Row, 5)) '

Give this a whirl, and see what works...
Thank you, Dokoll.
But there's an error message "Subscript out of range" on:
NombreID = CInt(mFlex.TextMatrix(mFlex.Row, 11)).
I've 11 columns, so i've changed the code a bit.

Is there any easier way to completely cleared the MSHFlexgrid? Because MSHFlexgrid.clear or MSHFlexgrid.refresh doesn't make the MSHFlexgrid to start from the first row if I enter a new data after deleting the old ones.

Thank you very much!
NAIRDA
Jun 8 '07 #3
cmrhema
375 256MB
Thank you, Dokoll.
But there's an error message "Subscript out of range" on:
NombreID = CInt(mFlex.TextMatrix(mFlex.Row, 11)).
I've 11 columns, so i've changed the code a bit.

Is there any easier way to completely cleared the MSHFlexgrid? Because MSHFlexgrid.clear or MSHFlexgrid.refresh doesn't make the MSHFlexgrid to start from the first row if I enter a new data after deleting the old ones.

Thank you very much!
NAIRDA
Hello Nairda

I am using MSHFlexgird only to dispaly. eg. When a user selects a district it will display all the products available in the same. If the user selects another district the previous values are removed and new values of the same are displayed.

May be you require a little alteration in my code. The code below clears and sets the order
MSHFlexGrid1.Clear
MSHFlexGrid1.Rows = 1
MSHFlexGrid1.Cols = 1
'Change the col as per your requirement
Before you write your display code write the above three lines and proceed with your coding, And kindly let us know if its working
Jun 8 '07 #4
nairda
39
Hello Nairda

I am using MSHFlexgird only to dispaly. eg. When a user selects a district it will display all the products available in the same. If the user selects another district the previous values are removed and new values of the same are displayed.

May be you require a little alteration in my code. The code below clears and sets the order
MSHFlexGrid1.Clear
MSHFlexGrid1.Rows = 1
MSHFlexGrid1.Cols = 1
'Change the col as per your requirement
Before you write your display code write the above three lines and proceed with your coding, And kindly let us know if its working

Hello to you too, cmrhema.
Thanks for the reply.
Yes, I also use the MSHF for displaying the data. The difference is My MSHF displays the data from an input form (My MSHF works like a selling receive record. It contains Date of Transaction, Amount, and Quantity of merchandise sold). So, if you fill the input form and then clicked a "SAVE" command button, VB will add a new data in both MSHF and database. The problem is, if I cleared the MSHF (Canceling the transaction by clicking a "CANCEL" button) and then added another input and then I clicked the "SAVE" button once again, the data will be displayed in the 2nd row of the MSHF and left the 1st row blank (Its belongs to the 1st data that I've already deleted)
I can't find a way how to return the MSHF's row index, so if I clicked the "SAVE" button, it'll show the data in the 1st row.

I've tried your code, but there's another problem: It sets the MSHF row to 1 so if I entered two kind of mercandise sold in one MSHF, VB will show an error message "Subscript out of range" because MSHF only has 1 row and my input needs 2 rows.
But its works very well if I only done an input action one at a time.

Thank you very much for your help.
NAIRDA
Jun 11 '07 #5

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

Similar topics

1
by: dave | last post by:
I've designed a nice little App that works something like a spreadsheet using the MSHFlexgrid control. Many users are inclined to press the tab key, expecting the program to respond like excel...
0
by: dimpy | last post by:
Hi everyone, I am using some big size data adapters to fill datasets to be sent to a web service. Now every time i get an error in datatype or constraints violations while filling the dataset, I...
2
by: nairda | last post by:
Hi, I'm Adrian from Indonesia. I have a problem using MSHFlexgrid in VB. I want to show a data from a single cell in MSHFlexgrid that I choose by mouse click in a textbox. The problem is, how to...
0
by: berry | last post by:
Hi all, I want to get the data within 1week. Then the data has to be seperated in sun, mon... In each day, there are 4more sub that i must seperate and total up the same sub quantity. All data and...
4
by: nairda | last post by:
Hi all, I have a MSHFlexgrid to show my database and some textboxes to show datas I choosed from MSHFlexgrid. I would like to know if there's a way to show a specific data I choosed from MSHF in...
1
by: babbles | last post by:
I have a problem about data reports. My project is to view reports monthly, yearly and daily and show the query on MShflexgrid and show the total income summary. I have already made my query on that...
2
by: WhiteShore | last post by:
hi there just wonder is it possible to save all the data item from mshflexgrid that has been retrieved from another table? let say i got 1 table called A and has been retrieved by mshflexgrid,...
1
by: kunudesai | last post by:
i have a data in list box OR in mshFlexGrid control. i want to write that data into .ini file using vb6.0 how can i do it. my data is like GJ 21 E 6943 GJ 06 AC 1432 Invalid...
2
Fary4u
by: Fary4u | last post by:
Hi it's my 1st post in VB, i'm trying to get data from ComboBox & result with MSHFlexGrid it's working fine there is no problem they only thing i need is Another ComboBox & ( result...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
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.