Solved

DATAGRIDVIEW VISIBLE = FALSE PROBLEM

Posted on 2014-10-16
4
129 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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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
Comment Utility
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
Comment Utility
When Enter Event occurs?
0
 
LVL 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

11 Experts available now in Live!

Get 1:1 Help Now