Solved

DATAGRIDVIEW VISIBLE = FALSE PROBLEM

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

803 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