Solved

VB6 - Compare MSHFlexgrid row 0 with TEXTbox

Posted on 2013-01-04
3
601 Views
Last Modified: 2013-01-05
Hello all

I would like to validate from every cell of my MSHFlexgrid1 row 0 with every name entered in  my TEXT2 multiLine .

Ex:
If MSHFlexGrid1.TextMatrix(0, 0) is not equal to my TEXT1 1 row of Multiline, it would give me a msg saying that it does not match.

It would validate all cell of row 0 of the MSHFlexgrid1.

How can i do that?

Thanks again for your help

picture 1

This is what i have for now:
Private Sub rate999_Click()
    Dim lngCol As Long

    For lngCol = 0 To MSHFlexGrid1.Cols - 1
        If MSHFlexGrid1.TextMatrix(0, lngCol) = TEXT1 .Text Then
        Else
            Call MsgBox("Heather doesn't match. Please validate.", vbExclamation, "Heather Validation")
            Exit Sub
        End If
    Next
End Sub

Open in new window

0
Comment
Question by:Wilder1626
  • 2
3 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 38746702
Private Sub rate999_Click()
    Dim lngCol As Long
    Dim lngIndex As Long
    Dim strParts() As String
    Dim bFound As Boolean
    
    strParts = Split(Text1.Text, vbCrLf)
    For lngCol = 0 To MSHFlexGrid1.Cols - 1
        bFound = False
        For lngIndex = 0 To UBound(strParts)
            If MSHFlexGrid1.TextMatrix(0, lngCol) = strParts(lngIndex) Then
                bFound = True
                Exit For
            End If
        Next
        If Not bFound Then
            MsgBox "Header doesn't match. Please validate.", vbExclamation, "Header Validation"
            Exit Sub
        End If
    Next
End Sub

Open in new window

0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 38746714
Thank you so much again. this is perfect.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 38746720
You're welcome and I'm glad I was able to help.

Select the 'About Me' tab in my profile and you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2012
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now