Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Clearing a combobox's text area in code

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-02-2008, 07:54 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default Clearing a combobox's text area in code

I am wondering how do I clear the text part of a combobox on a form?

It doesn't have a text property and setting SelectedIndex to -1 does nothing.

regards, Ricky
Reply With Quote
  #2 (permalink)  
Old 10-02-2008, 08:48 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

First question : Why do you want to clear the text in the combobox ?
It is more usefull to make a default selection directly after having initilized the comboboxe's values, this usage avoids also some other possible errors.

Have a look at this:
http://www.basic4ppc.com/forum/quest...mbo-boxes.html

Best regards
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #3 (permalink)  
Old 10-02-2008, 08:52 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

If you really need to you can use the Door library. obj1 is a Door library Object.

Code:
obj1.New1(False)
 ....
obj1.FromControl(
"Combobox1")
obj1.SetProperty(
"Text","")
Reply With Quote
  #4 (permalink)  
Old 10-02-2008, 09:07 AM
Basic4ppc Veteran
 
Join Date: Jul 2008
Location: Schwäbisch Gmünd
Posts: 353
Default ... another question ...

In this case I have another question:

Is it possible to add text to a combobox an save it?

I mean on the PocketPC, not on the desktop.

Example:

You have a combobox with 4 predefined words in it.

Apple
Bread
Eggs
Butter

Now you want to add No5, for example "Milk", and you want to save it to use it another time.

Is this possible (and how)?

THANKS if someone knows a solution.
__________________
JOTHA | Greetz from the Schwabenländle.
Pocket-PC: HTC HD2 (Dual-Boot WindowsMobile 6.51 + Android 2.2 Froyo)
Reply With Quote
  #5 (permalink)  
Old 10-02-2008, 09:29 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default Thanks

Thanks Agraham, that works just right

Klaus: I need to have it clear when I add a new DailyTarget entry. The field has no default - I have designed it this way.

Jotha: use the Add method of the combobox to add new items. If you store them in a database then you'll need to add a new record to it too. I'm using SqlLite as my database.
Reply With Quote
  #6 (permalink)  
Old 10-02-2008, 09:31 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 4,463
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Hello JOTHA,

You can do it that way:
- add a TextBox, where the user can input the new text.
- add a Button, when clicking it, the program adds the new text in the Combobox.
- save all the values and their number in aread this file at file when closing the program
- read this file at the start of the program and initialize the ComboBox.

I am using this way of dooing in this program http://www.basic4ppc.com/forum/share...e-tracker.html in the Config panel.

Best rgards.
__________________
Klaus
Switzerland

Beginner's Guide / User's Guide
Reply With Quote
  #7 (permalink)  
Old 10-02-2008, 09:31 AM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Adding new items is simple enough, you just need to use ComboBox1.Add("value")
If you want to save this for the next time the program is loaded then you need to store the values somewhere.
This could be an ini file or the simplest method would be to use a table to store the values, saving and loading to a csv file.

Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert the generated text into code ? mozaharul Questions (Windows Mobile) 3 10-06-2008 06:42 AM
how to transform a text in code? anjosafado Questions (Windows Mobile) 7 10-04-2008 01:43 PM
Coverting text files with binary file page code functionality kolbe Code Samples & Tips 1 06-21-2008 05:06 PM
Area Selection by combo boxes mozaharul Questions (Windows Mobile) 4 04-30-2008 04:36 AM
Dividing the code into text files... Cableguy Questions (Windows Mobile) 5 05-21-2007 03:21 PM


All times are GMT. The time now is 02:35 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0