473,672 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting Excess rows of MSFlexGrid

63 New Member
Hey, I'm using the following code to filter an msflexgrid to only display
rows with the entry "East Cork" in the 8th column. The table has many more entries, so, when I run the application, many rows are left blank. How can I get rid of these rows ? Here's my code, thanks in advance

Private Sub Form_Load()

MSFlexGrid1.All owUserResizing = flexResizeColum ns
MSFlexGrid1.Sel ectionMode = flexSelectionBy Row

MSFlexGrid1.Tex tMatrix(0, 0) = "ID"
MSFlexGrid1.Tex tMatrix(0, 1) = "Customer"
MSFlexGrid1.Tex tMatrix(0, 2) = "Pickup Name"
MSFlexGrid1.Tex tMatrix(0, 3) = "Pickup Address"
MSFlexGrid1.Tex tMatrix(0, 4) = "Pickup Area"
MSFlexGrid1.Tex tMatrix(0, 5) = "Telephone Number(s)"
MSFlexGrid1.Tex tMatrix(0, 6) = "Delivery Name"
MSFlexGrid1.Tex tMatrix(0, 7) = "Delivery Address"
MSFlexGrid1.Tex tMatrix(0, 8) = "Destinatio n Area"
MSFlexGrid1.Tex tMatrix(0, 9) = "Telephone Numbers(s)"
MSFlexGrid1.Tex tMatrix(0, 10) = "Weight of Package (in kg)"
MSFlexGrid1.Tex tMatrix(0, 11) = "Delivery Price"
MSFlexGrid1.Tex tMatrix(0, 12) = "Pickup Date"
MSFlexGrid1.Tex tMatrix(0, 13) = "Delivery Date"
MSFlexGrid1.Tex tMatrix(0, 14) = "Priority"

MSFlexGrid1.Col Width(0) = 2000
MSFlexGrid1.Col Width(1) = 2500
MSFlexGrid1.Col Width(2) = 2500
MSFlexGrid1.Col Width(3) = 2750
MSFlexGrid1.Col Width(4) = 2500
MSFlexGrid1.Col Width(5) = 2500
MSFlexGrid1.Col Width(6) = 2500
MSFlexGrid1.Col Width(7) = 2750
MSFlexGrid1.Col Width(8) = 2500
MSFlexGrid1.Col Width(9) = 2500
MSFlexGrid1.Col Width(10) = 2500
MSFlexGrid1.Col Width(8) = 2500
MSFlexGrid1.Col Width(9) = 2500
MSFlexGrid1.Col Width(10) = 2500
MSFlexGrid1.Col Width(11) = 2500
MSFlexGrid1.Col Width(12) = 2500
MSFlexGrid1.Col Width(13) = 2500
MSFlexGrid1.Col Width(14) = 2500

Open App.Path & "\deliveries.tx t" For Input As #12

Dim oldRow As Long
Dim lngRow As Long
Dim lngCol As Long
Dim i As Long

Dim tRow As Long
Dim tCol As Long


Dim strID As String

MSFlexGrid1.Row s = 2

Do Until EOF(12)

Input #12, strID, strCustomer, strPickupName, strPickupAddres s, strPickupArea, strPTelephoneNu mbers, strDeliveryName , _
strDeliveryAddr ess, strDestinationA rea, strDTelephoneNu mbers, strWoP, strDeliveryPric e, _
strPickupDate, strDeliveryDate , strPriority

If frmLogin.cboLog in.Text = "Kevin" And strDestinationA rea = "East Cork" Then


MSFlexGrid1.Tex tMatrix(1, 0) = strID
MSFlexGrid1.Tex tMatrix(1, 1) = strCustomer
MSFlexGrid1.Tex tMatrix(1, 2) = strPickupName
MSFlexGrid1.Tex tMatrix(1, 3) = strPickupAddres s
MSFlexGrid1.Tex tMatrix(1, 4) = strPickupArea
MSFlexGrid1.Tex tMatrix(1, 5) = strPTelephoneNu mbers
MSFlexGrid1.Tex tMatrix(1, 6) = strDeliveryName
MSFlexGrid1.Tex tMatrix(1, 7) = strDeliveryAddr ess
MSFlexGrid1.Tex tMatrix(1, 8) = strDestinationA rea
MSFlexGrid1.Tex tMatrix(1, 9) = strDTelephoneNu mbers
MSFlexGrid1.Tex tMatrix(1, 10) = strWoP
MSFlexGrid1.Tex tMatrix(1, 11) = strDeliveryPric e
MSFlexGrid1.Tex tMatrix(1, 12) = strPickupDate
MSFlexGrid1.Tex tMatrix(1, 13) = strDeliveryDate
MSFlexGrid1.Tex tMatrix(1, 14) = strPriority

End If


MSFlexGrid1.Row s = MSFlexGrid1.Row s + 1
For lngRow = MSFlexGrid1.Row s - 2 To MSFlexGrid1.row Step -1
For lngCol = 0 To MSFlexGrid1.Col s - 1
MSFlexGrid1.Tex tMatrix(lngRow + 1, lngCol) = MSFlexGrid1.Tex tMatrix(lngRow, lngCol)
If lngRow = MSFlexGrid1.row Then
MSFlexGrid1.Tex tMatrix(lngRow, lngCol) = "" 'Make the current row empty
End If
Next
Next

i = 0

Loop

Close #12

Do While i < MSFlexGrid1.Row s

If MSFlexGrid1.Tex tMatrix(i, 0) = "" Then

MSFlexGrid1.Rem oveItem i

End If

i = i + 1

Loop

MSFlexGrid1.Col = 13
MSFlexGrid1.Sor t = flexSortStringA scending

For tRow = 1 To MSFlexGrid1.Row s - 1

MSFlexGrid1.row = tRow

If MSFlexGrid1.Tex tMatrix(tRow, 14) = "Low" Then

For tCol = 0 To MSFlexGrid1.Col s - 1

MSFlexGrid1.Col = tCol
MSFlexGrid1.Cel lBackColor = RGB(204, 255, 153)

Next

ElseIf MSFlexGrid1.Tex tMatrix(tRow, 14) = "Medium" Then

For tCol = 0 To MSFlexGrid1.Col s - 1

MSFlexGrid1.Col = tCol
MSFlexGrid1.Cel lBackColor = RGB(202, 225, 255)

Next

ElseIf MSFlexGrid1.Tex tMatrix(tRow, 14) = "High" Then

For tCol = 0 To MSFlexGrid1.Col s - 1

MSFlexGrid1.Col = tCol
MSFlexGrid1.Cel lBackColor = RGB(255, 228, 225)

Next

End If

Next

End Sub
Mar 18 '08 #1
0 1308

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

Similar topics

5
14734
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am trying to delete these lines from the dataview like this: for (int i=0; i < dataView.Count; i++) if (dataGrid.IsSelected(i)) dataView.Delete(i);
5
2350
by: Patrick Vanden Driessche | last post by:
Hi All, I'm currently writing an in-house Form validation framework (WinForms) which is based on 'Component'-inheriting object. So basically, I have a small hierarchy. FormValidator +-- ControlValidator +--ValidationRule
0
1414
by: Martin K | last post by:
Hello all..thanks for everyone's advice regarding my SHBrowseForFolder API problem, I was able to put together a public class that runs great! But I have another migration headache regarding the MSFlexGrid. I have been able to successfully add a COM object MSFlexGrid in my VB.Net project. I can successfully populate and manipulate the grid. But, I have two problems, that I used to be able to do with no issues in VB 6. 1) AutoSizing...
0
1402
by: snowe | last post by:
HI I am now difficult to get the row index in MsFlexGrid when we right click on rows. And how to add the controls in Ms FlexGrid in VB.Net. Snowe
0
1043
by: debjanidutta090483 | last post by:
How different forecolor is given in different rows of a MSFlexGrid in VB6 during runtime?
3
3294
by: mahesh123 | last post by:
Hi, I want to select the records in multiselection randomly in the MSFlexGrid? In MSFlexGrid there is multiselection option by press the Shift key and select the records, but there we can selecting the records sequentially. I want to select the multiple records in randomly. Its very urgent for me. Please help as soon as possible. Thanks ---------- Mahesh
1
4336
by: MiziaQ | last post by:
Hey, how can I delete an entire row from an MSFlexGrid table, and how can I allow the user to only select one row (i.e. not allow multiselection of rows ?) Thanks in advance, MiziaQ
3
2584
by: MiziaQ | last post by:
Hey, I would like to delete a row of data from my data file, though using an MSFlexGrid. I can currently delete any selected row, though it only deletes a row from the Grid, and not the entry itself. Please Help
4
1472
by: MiziaQ | last post by:
Hey, I'm using the following code to write entries to a data file and then read them in an msflexgrid. I now would like to add code under a delete button to use the table(grid) to delete rows from the file. How can I do that. I have some code for deleting a row from the table, but it's only deleting the row from the table, and not the entry itself. Please help! Is there a relatively easy way to do this ? Private Sub cmdAddDelivery_Click() ...
0
8419
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8945
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8844
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8642
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8696
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7472
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5720
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2836
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 we have to send another system
2
1836
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.