VB NET Textbox code duplication?
-
Is there a way to maker this code work in a textbox instead of a Listbox? I am trying to stop duplication in one of my textbox for Member ID to make it so the number entered if it already exists in my access table it will not accept it memID = Val(TextBox1.Text) If Cnt1 = 0 Then Flag1 = 0 Else For i = 0 To Cnt1 - 1 MsgBox("Member ID Already exists") 'MsgBox(memID & Arr(i)) If memID = Arr(i) Then Flag1 = 1 End If Next End If If Flag1 = 1 Then Flag1 = 0 TextBox1.Clear() TextBox1.Focus() Else Arr(Cnt1) = memID 'ListBox1.Items.Add(memID) 'ListBox2.Items.Add(Arr(Cnt1)) MsgBox("added") Cnt1 = Cnt1 + 1 TextBox1.Clear() TextBox1.Focus() End If Thank You
-
Answer:
You attempted to incorporate the code I developed for another question . This code will not work, unless it is modified to do what you are attempting to do. You even left the message boxes I installed to test the code. If you will edit your question to include the name and path to your Access data base, when I get time, I will modify the code to fir your purpose. TexMav
Laura at Yahoo! Answers Visit the source
Other answers
memID = Val(TextBox1.Text) If Cnt1 = 0 Then Flag1 = 0 Else For i = 0 To Cnt1 - 1 MsgBox("Member ID Already exists") 'MsgBox(memID & Arr(i)) If memID = Arr(i) Then Flag1 = 1 End If Next End If If Flag1 = 1 Then Flag1 = 0 TextBox1.Clear() TextBox1.Focus() Else Arr(Cnt1) = memID 'TextBox1.Text = memID 'TextBox2.Text = (Arr(Cnt1)) MsgBox("added") Cnt1 = Cnt1 + 1 TextBox1.Clear() End If
Trollface.jpg
Related Q & A:
- How to Convert Code from VB to C++?Best solution by Stack Overflow
- How to filter databound listbox using textbox?Best solution by Stack Overflow
- How to save from DatagridView to Database VB.NET?Best solution by Stack Overflow
- How to get textbox by name?Best solution by Stack Overflow
- How do I make a textbox transparent?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.