Solved

DATAGRIDVIEW VISIBLE = FALSE PROBLEM

Posted on 2014-10-16
4
134 Views
Last Modified: 2014-10-17
Hi Experts

in my  textbox1  presskey i have the following code

      If e.KeyChar <> "" Then

            Dim dv As New DataView
            Dim regicx As String = ""
            If e.KeyChar < "A" Or e.KeyChar > "z" And e.KeyChar <> ControlChars.Back Then
                If Microsoft.VisualBasic.Len(codeBox.Text.Trim) > 0 Then
                    regicx = Microsoft.VisualBasic.Left(codeBox.Text, Microsoft.VisualBasic.Len(codeBox.Text.Trim) - 1)
                End If
            Else
                regicx = codeBox.Text.Trim + e.KeyChar.ToString
            End If
            Dim reglenx = Microsoft.VisualBasic.Len(regicx)
            dv = New DataView(dtCustFull, "Substring(ccode, 1, " & reglenx & ")= '" & regicx & "'", "", DataViewRowState.CurrentRows)
            DataGridView2.DataSource = dv
            DataGridView2.Visible = True
        Else
            DataGridView2.Visible = False
        End If

and then textbox1 keydown
  DataGridView2.Visible = False

But   DataGridView2 is still visible

I have even tried in the next textbox.gotfocus
  DataGridView2.Visible = False

still same problem

I tried this code in myform.click
  DataGridView2.Visible = False

and when I click on my form it disappears.

Please help
0
Comment
Question by:b001
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 40384931
If e.KeyChar <> "" Then
    Else
            DataGridView2.Visible = False
        End If

Considering it's a keyPress I don't think e.KeyChar will ever be blank.

Did you confirm the textbox.GotFocus actually fires?

Try the Enter Event.
0
 

Author Comment

by:b001
ID: 40384963
The nextbox when gotfocus

I put  to check if it gets the focus. it does, but it stays in the loop for a while.
 msgbox("Y")
 DataGridView2.Visible = False
0
 

Author Comment

by:b001
ID: 40384975
When Enter Event occurs?
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 40385210
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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

827 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