Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6 - Compare MSHFlexgrid row 0 with TEXTbox

Posted on 2013-01-04
3
Medium Priority
?
626 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 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 49

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

715 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