PC Review


Reply
Thread Tools Rate Thread

Adding empty space to listbox?

 
 
=?Utf-8?B?SHVzYW0=?=
Guest
Posts: n/a
 
      5th Jul 2005
Hi EveryBody:

I made project by Vb.Net which consist the following items:

1\ Textbox
2\Button
3\Listbox

When you write any thing in the textbox and press the button any text
written in the textbox will be added to the listbox, but i figure that when
you just press the space button in the keyboard for how long you want, that
empty space in the textbox will be added to the listbox when you press the
button.

So any one can help and give me any hint or direction how can I prevent
adding any empty space in the textbox to the listbox?

Any help will be appreciated

regard's

Husam
 
Reply With Quote
 
 
 
 
Richard L Rosenheim
Guest
Posts: n/a
 
      5th Jul 2005
Validate the contents of the textbox before adding it the listbox.


"Husam" <(E-Mail Removed)> wrote in message
news9A2E25B-D4A1-403F-86D6-(E-Mail Removed)...
> Hi EveryBody:
>
> I made project by Vb.Net which consist the following items:
>
> 1\ Textbox
> 2\Button
> 3\Listbox
>
> When you write any thing in the textbox and press the button any text
> written in the textbox will be added to the listbox, but i figure that

when
> you just press the space button in the keyboard for how long you want,

that
> empty space in the textbox will be added to the listbox when you press the
> button.
>
> So any one can help and give me any hint or direction how can I prevent
> adding any empty space in the textbox to the listbox?
>
> Any help will be appreciated
>
> regard's
>
> Husam



 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      5th Jul 2005
Husam,

It seems quiet normal what you tell.

I think that if it was my problem that I would use the Trim and than look if
the lenght of the text after that was longer than 0.

MyString = Trim(MyTextbox.Text)
If MyString.Length > 0
'procedure to add the mystring or the mytextbox.text to the listbox
End if

In my opinion is with mystring text than also direct nicer in your listbox.
(However there can be reason not tot do that)

I hope this helps,

Cor


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      5th Jul 2005
"Husam" <(E-Mail Removed)> schrieb:
> When you write any thing in the textbox and press the button any text
> written in the textbox will be added to the listbox, but i figure that
> when
> you just press the space button in the keyboard for how long you want,
> that
> empty space in the textbox will be added to the listbox when you press the
> button.
>
> So any one can help and give me any hint or direction how can I prevent
> adding any empty space in the textbox to the listbox?


\\\
If Len(Trim(Me.TextBox1.Text)) > 0 Then
Me.ListBox1.Items.Add(Me.TextBox1.Text)
Else
With Me.TextBox1
.Text = ""
.Focus()
End With
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding items from Listbox to empty textbox Corey .... Microsoft Excel Programming 2 30th Jan 2009 02:38 AM
Empty listbox Jean-Paul Microsoft Access Form Coding 1 23rd Oct 2008 01:55 PM
empty listbox contato Microsoft Access Form Coding 1 12th Jun 2008 12:03 AM
Empty Listbox Asif Microsoft Access 2 12th Apr 2007 10:52 PM
empty listbox =?Utf-8?B?UGV0ZXJN?= Microsoft Access 1 4th Mar 2005 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:59 AM.