473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

From textBox To Listbox

"HI! im using the following code to fill a listbox from a textbox

Code:
Dim strNMBCY As Long
strNMBCY = Len(UserForm1.txtNMB)

If strNMBCY > 1 Then
UserForm2.ListBox1.AddItem UserForm1.txtNMB
UserForm2.ListBox2.AddItem UserForm1.txtNMB
End If

The problem is that it fills in a strange way Ex:
If I write in the textbox = Phill
It shows in the listbox like this =
P
Ph
Phi
Phil
Phill

Instead of only one word = Phill
Sep 11 '09 #1
4 4039
CyberSoftHari
487 Expert 256MB
check the event of the code part? i think it will be in textbox or form, keypress or key up or down events
Sep 11 '09 #2
@CyberSoftHari

The event is change, and with the other events is the same thing!! HELP PLEAASEEE
Sep 11 '09 #3
smartchap
236 100+
Since u have placed code in the Change event of txtNMB in UserForm1, as soon as u change any data in txtNMB (either delete a character or add a character) addition of content of txtNMB will take place in ListBox1 & ListBox2 in UserForm2. So I think u can put this code either in other command button or in the LostFocus event of txtNMB. Or u place the code in the KeyPress event of txtNMB with a check that if KeyPress is vbKeyReturn then go to the code like:
Expand|Select|Wrap|Line Numbers
  1. Private Sub TxtNMB_KeyPress(KeyAscii As Integer)
  2.   If KeyAscii = vbKeyReturn then
  3.      ......ur code here to add items to ListBoxes
  4.   End If
  5. End Sub
  6.  
Sep 12 '09 #4
@smartchap


Thank you very much, I used the initialized event in the other form and it works perfectly.
Sep 14 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John R. | last post by:
I want to add a textbox next to each item in a Listbox on a Windows Form. The items need to be scrollable so I thought that maybe this is possible with an Owner Draw listbox. Searching the web...
28
by: kfrost | last post by:
I know this is probably simple but I have a C# form and the class for the form is called sbaSynch. I have a textbox name txtServerName. I'm creating a class to manipulate XML functions so I...
4
by: Kav | last post by:
As the title states, on my development PC there is a textbox which allways displays as a textbox. However on the clients PC it is showing previous entries he has made to the TextBox as a ListBox. ...
0
by: Alpha | last post by:
Hi, I have a listbox and a textbox which is bind to the same dataset's column. So the selected item is display in the textbox availbe for editing. When I change the text in the textbox it has...
7
by: tom | last post by:
Hi, I want a listbox below a hidden calendar control. The problem is that the listbox will shadow the calendar when the calendar is visible. How can I bring the calendar from back to front? ...
2
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page...
14
by: Professor Yonce | last post by:
I have made form for E-Mail. I have entered code but the Import system does not work. It has squiggly line underneath it showing it is not communicating. It Will not build. Public Class...
5
by: lukasmazur | last post by:
Hi I have a problem with using listBox1. I have a two forms form1 and form2. In form1 are controls listBox1, textBox1 and button witch creating object of class Form2. In class Form2 I create a...
0
by: Miha | last post by:
Hello im new here and to programing. At the moment i am trying to code a program that would load a webpage in Textbox, then parse number between var lv_screenshots =...
1
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.