Solved

DATAGRIDVIEW VISIBLE = FALSE PROBLEM

Posted on 2014-10-16
4
136 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
[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
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

728 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