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
Solved

Check for text in grid

Posted on 2000-04-15
7
186 Views
Last Modified: 2010-05-02
Can you tell me what I am doing wrong.
I am trying to check a grid with only one Row and checking each coloum or(sel) in that row to see if the coloum or(sel) is empty or has text.
This is some of my code.

W = 1
  Grid2.Row = 0
             For T = 0 To NoCols - 1
             Grid2.Col = T
            If Grid2.Text = "" Then
            'If Len(Grid2.Text) = 0 Then
            W = 0
           
            End If
    Next T
0
Comment
Question by:mad3654
7 Comments
 

Expert Comment

by:shideyi
ID: 2719041
in your program, as long as there is 1 cell with text = "", W will be set to zero, instead use the following code:

W = 0
Grid2.Row = 0
For T = 0 To NoCols - 1
  Grid2.Col = T
  If Grid2.Text <> "" Then
    W = 1
  End If
Next T

also, if you are using MS flexgrid, the first row will be the columnheader, not the first row containing data.
0
 

Author Comment

by:mad3654
ID: 2719115
Adjusted points from 50 to 75
0
 

Author Comment

by:mad3654
ID: 2719116
I tried this code and it always returns W as 0.  I want to check a grid with one Row and each coloumn or is it sel, of that Row to see if any of the coloumns or sels have no text.  
If ALL coloumns or sels have text then W = 0
Else W = 1.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 6

Accepted Solution

by:
Marine earned 75 total points
ID: 2719154
Try this code. It should work. I didn't test it.
With msFlexGrid
For i = 0 To .Rows - 1
    For j = 0 To .Cols - 1
       If .TextMatrix(i, j) = "" Then
          .TextMatrix(i, j) = "0"
       Else
          .TextMatrix(i, j) = "1"
       End If
    Next
Next
end with
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2719291

Dim RowHasAColEmpty as Boolean
Dim lngRow as Long
Dim lngCol as Long

Dim lngRow = 3 ' Or any other row you want

With MSFlexGrid1
  For lngCol = 0 To .Cols - 1
    If Len(.TextMatrix (lngRow, lngCol)) = 0 _
    Then
      RowHasAColEmpty = True
      Exit For
    End If
  Next lngIndex
End With

If RowHasAColEmpty _
Then
  ' Do Your Processing here
End If
0
 

Author Comment

by:mad3654
ID: 2719313
Marine's code worked with a little modifications. thanks
0
 
LVL 6

Expert Comment

by:Marine
ID: 2719326
happy programming :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 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