Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




List Boxs


How do I remove data from 1 list box and have it appear in another? Also once I have moved data from the first list, I world like to update the list and have the data removed?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Help With VB List Boxs
Hey, im making a VB port blocker using winstock but thats not the problem. My problem is you type in the port number and it addes it to the list. But how can i get all thoose number from the list. For example

They want to block ports 25,36,4500,2008 and they add it to the list. I then want to get the numbers out of there so that winstock will bind port 25,36,4500,2008

i put this in general because the list box is the problem!

Thanks

Multiple List Boxs
Hey, i've got a little problem with multiple list boxes

ok, so i have 12 list boxes, in 2 groups of 6 on each side of the from, like the image attatched, i can't work out how i can select one item from one side, then another item from the other side, click add and the selected items go into the middle list.

Print All Text Fr List And Txt Boxs
I have 3 text boxes on a form, how can I print them and ensure I get all of the contents (sometimes they have more text than can fit so they have scrollbars) using PrintForm sometimes they get cut when they have scrollbars, as I am sure you all know!

I just want to print them on on top of the other but ensure it prints all the text

Text1.Text = "Some Text"
Text2.Text = "SomeMore Text"
Text3.Text = "EvenMore Text"


Printed page would be:

Some Text

SomeMore Text

EvenMore Text

(one return between each text box info)

Sorry, I put list boxes in the title but there are not any!

Printing Multiple List Boxs
I was wondering if anyone could help me with this problem? I cant figure out how to print out multiple List Boxes. Please email me a klubhead9985@yahoo.com

List Boxs And Random Access Files HELP!
I am using a random access file to create a program. in this program, names that have already been saved to the random access file, are added to a list box. from here they are arranged in groups in other list boxes. i am having trouble saving which list box each name from the random access file is moved to.
heres my code from the page

Option Explicit

Private Type AcctRec
Cnum As Integer
Cubfirstname As String * 15
Cublastname As String * 20
Cubaddress As String * 150
Cubnumber As Integer
Cubemail As String * 75
Cubbirth As Integer
Cubage As Integer
Cubschool As String * 20
cubother As String * 150
End Type
Private CubRec As AcctRec



Private Sub add1_Click()
List1.AddItem (List6.Text)
Dim PositionInList As Integer
Dim NumberOfItemsInList As Integer
PositionInList = List6.ListIndex
NumberOfItemsInList = List6.ListCount
If NumberOfItemsInList > 0 Then
If PositionInList >= 0 Then
List6.RemoveItem PositionInList
Else
MsgBox "You must select an item to delete.", 48, "Error"
End If
Else
MsgBox "There are no items to delete.", 48, "Error"
End If
NumberOfItemsInList = List6.ListCount
If NumberOfItemsInList > 0 Then
If PositionInList = NumberOfItemsInList Then
List6.ListIndex = NumberOfItemsInList - 1
Else
List6.ListIndex = PositionInList
End If
End If
List6.SetFocus
End Sub

Private Sub Delete1_Click()
List6.AddItem (List1.Text)
Dim PositionInList As Integer
Dim NumberOfItemsInList As Integer
PositionInList = List1.ListIndex
NumberOfItemsInList = List1.ListCount
If NumberOfItemsInList > 0 Then
If PositionInList >= 0 Then
List1.RemoveItem PositionInList
Else
MsgBox "You must select an item to delete.", 48, "Error"
End If
Else
MsgBox "There are no items to delete.", 48, "Error"
End If
NumberOfItemsInList = List1.ListCount
If NumberOfItemsInList > 0 Then
If PositionInList = NumberOfItemsInList Then
List1.ListIndex = NumberOfItemsInList - 1
Else

End If
End If
List1.SetFocus
End Sub

Private Sub Form_Load()
Dim FileName As String
FileName = "Cubs"
If FileName <> "" Then
Open FileName For Random As #1 Len = Len(CubRec)
End If
Dim RecNo As Integer
RecNo = 1
Get #1, 1, CubRec
While Not EOF(1)
If RecNo = CubRec.Cnum Then
List6.AddItem CubRec.Cubfirstname & "" & CubRec.Cublastname & "" & CubRec.Cubage
End If
RecNo = RecNo + 1
Get #1, RecNo, CubRec
Wend
End Sub

has anyone got any suggestions?

Using List Boxs, Adding Records And Stuff
hey um i need to make a list box and load an array of records into the list box i guess using the additem method, but i need to make it so that when someone clicks on an item in the list box underneath in labels the rest of the record would be displayed (so only the name would be displayed in the list box, has anyone got suggestions?

i think i can fill the list box, just need to know the command for when someone clicks on one...

Msg Boxs
I am sure this will be an easy one for the gurus.... I want to read a disclaimer (large paragraph in a text file) and display as a msg box using vbscript. Help would be appriciated.

Help With Combo Boxs
ii know this may be VERY easy but im new and i read some tut's but i cannot figure this out
Heres the Layout
http://img265.imageshack.us/img265/1268/untitlediv5.png

Simple I want it so people select a item in the combo box and it add to the coding the center. By pressing Insert. and adds it to the Text Bar. Cause normal letters have values to. Each have values i know already. That edits this part of coding.
http://img369.imageshack.us/img369/6...titled2wp1.png

And when NTSC Or PAL is selected it changes this coding
http://img146.imageshack.us/img146/3...titled3mk6.png

Check Boxs Only Two
I have 6 check boxs and I want it that only 2 check boxs can be selected at any time.
Can this be done and how.

Lots Of Txt Boxs
Hi there
I have this application with one main form and twenty (20) other forms. The idea is that clicking on a certain area of the main form will display on of the twenty other forms.
Each of these other forms have fifteen (15) text boxs and I am trying to save each text box on each form for a total of three hundred text boxs. The problem is that when I try to declare each txt box as a type variable
(Type myinfo
-300 different variables-
End type )
vb6 says that "there are too many non-static variables", and the program will not run.
Can someone tell me how I can go about saving the information on all the forms in one file, so that I can retreive them and put them back in the correct form and txt box when I need to.
Thanks

Check Boxs
I am having a problem with a check box and an access database. I have four cb's on a form and they are connected to an access db. In the DB is a field with a yes/no data type. My problem is when I go to show the fields from the db in the form, I get an error 380 invalid property value. The code that I am using is:
Check1.Value = myRecordset!Check1
Is this the syntax that I need or is it something else??
Thanks.
-- Jon

About Text Boxs
hi every bady
i please have 2 forms in the first one this are the fonction
text6.text= val(text4.text)+val(text5.text)
so inthe rusellt(text6) i want tow in the next form with same result please
i means one textbox in tox forms a same time
is it clair
thx alot
milen

How Do You Use Check Boxs?
I'd really like to know, as I'm not to sure how to use them, and it would really help with the project I'm doing. Thanx

Comparing Txt Boxs
hey, ive got two password boxs, and i want the to make sure that the user has put the corect password in each box(so they match) is there some way to check to see if they have done this?

thanks

Text Boxs
i want to be able to continualy load text into a textbox...
i need it to scroll the what is already in the box down a line and
load the newest text on the top... is this posiable?

Combo Boxs
I have a main form with a combo box, that has sub-form names in it. I have the names in the list property of the combo box. I want to be able to open the chosen form when i select it from the list. I think i am getting the syntax wrong and would appreciate any help.

Combo Boxs
Hi, got a problem with one of my combo boxes.
I want to add new values to my combo box using the notinlist event..and when the item is not in the list a form opens up and the user can then add the new values..

does anyone know how to do this??

This is the coding i'm using - can anyone see any errors of where i'm goin wrong?


Private Sub GandID_NotInList(NewData As String, Response As Integer)

    ' Add a new gang by typing a name in GangID combo box.

    Dim intNewgang As Integer, intTruncateName As Integer, strTitle As String, intMsgDialog As Integer

    ' Display message box asking if user wants to add a new category.
    strTitle = "gang Not In List"
    intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1
    intNewgang = MsgBox("Do you want to add a new gang?", intMsgDialog, strTitle)


        ' Open Addgang form.
        DoCmd.OpenForm "Addgang", acNormal, , , acAdd, acDialog, NewData

        ' Continue without displaying default error message.
        Response = acDataErrAdded
    End If
End Sub




 

Saving Check Boxs
OK i really couldent think of a better title,

But i have made a program that logs you into a website using the user/pass that you have suplied but i do not understand how to save information, like

If user/pass CheckBox = checked
then
Username.text.save

etc... i really cant explain it but i hope yous understand what i mean.

Text Boxs And Key Strokes
im having some trouble on this code, what im trying to do is make it so when i hit the enter key the number is taken from one field, converted to the other degree measurement and printed in the other field


basicly, i put a number in the celcius field, hit enter and it converts it and prints it into the ferinheit field


im using text boxes.. heres the code



Code:
Private Sub txtCel_KeyPress()
Keyascii As Integer
If (Keyascii = 13) Then
txtFahr.Text = Val(txtCels.Text * 9 / 5) + 32
End If
End Sub

Private Sub txtfah_KeyPress()
Keyascii As Integer
If (Keyascii = 13) Then
txtCels.Text = Val(txtFahr.Text - 32) * 5 / 9
End If
End Sub

Checkbox That Act Like Option Boxs
For reason being, i cant use option boxs so i have to do this the hard way.

Does anyone have an idea on how to do the following:

lets say... 5 check boxs in an array *check2(0) - check2(5)*

Only 1 check box can be checked at a time (like an option box)

Any ideas anyone?

Question About Input Boxs
What does
Code:
inputbox("test", "test")
return if someone presses cancel, I done

Code:
msgbox inputbox("test", "test")
and it shows "" but if someone presses ok and there is no text in the input box then it also shows "". How do I pick up if someone presses cancel?

Listbox With Check Boxs
hi
i have setup a form with a folder adder in a listbox and i have changed the style to checkbox.
im trying to get the value of one of the folders in the list to be true or 1 how can i do this

i have tryed

Code:
list1.list(1).value=1

Rich Text Boxs
3 quick questions::

1) is it possible to load html into a rich text box (act like a web browser)
2) if so would it be possible to have clickable links in it
3) if 1 and 2 are possible, then please let me know how

thanks

Dimava

Clear Out Text Boxs
Hello all


I am using the code below to clear all the text boxs , it works fine but not with all, there are two text boxs still not clear them.

I really do not know why !!!! ???


Did any one faced that problem ?


On Error Resume Next
For i = 0 To Me.Controls.Count - 1
Me.Controls(i).Text = ""
Next

Any one can help please ?

MA

How I Can Control Of Two DBCombo Boxs
Hi all


I have a table contains students and countries names.
I would like to control of two DBCombo Boxes as follow.

DBCombo1 contains counters' names and DBCombo2 contains students' names.

How I can write code when I click to DBCombo1 to choose one counter the DBCombo2 gave me only the students belong to that country.

Example: when I click to DBCombo1 to choose UK country, the DBCombo2 should shows or contains only students from UK.

I really need your great help, any one can help will be highly appreciated.

Thank you in advance.

Mohammed

Adding Text Boxs?
how can i add decimal numbers eg, text1 to text2 using a button?

i want to enter a decimal number into text1 then by pressing a button i want it to ADD to the total, text2. then when i press the button again i want text1 to add to that current number in text2.

any ideas?

thanx.

Numbers In Text Boxs
I have several text boxes that I want only numbers entered in to. The code I have is below and works fine; however I cannot delete the numbers in the box. Can some one point me in the right direction? Thanks.

Private Sub txtecam_KeyPress(KeyAscii As Integer)
If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
KeyAscii = 0
End If
End Sub

Take Control Of Dialog Boxs
Hi all,

i use the web browser control to view content of html web pages and to work with the dom object model of this web pages.
my problem is with a dialog boxs (Yes or No for example)
that apears on those web sites , i dont know how to take
control of them form my source code.
for example if a Yes/No dialog box apear in some web page
i dont now how to access it and how to take control of the Yes/No
buttoms.

thanx,
pokpoki

Combo Boxs And Text Boxes
Hey all,
How could I get a couple of text boxes in one form change the list in a combo box in a second form?

Thank You
-gamesfreke

Conditional Formatting With Combo Boxs?
is it possible to make the conditional format update a combo box if a new piece of data is entered into a clolumn of cells.

say for example i have cells A1 through A5 with data in and i add a new piece of data into cell A6.

Is there any way that i can set the conditional formatting up with VB to update a combo box with this new piece of data included.

Multi Line Text Boxs
Hi all I am doing a little excise trying to do my own word wizard i have done prety much everything but i want to change one thing .Currently i save the names and addrees in a comma seperated file i.e

"ed","1 st line off address","2nd line of Address","3 st line off address","4nd line of Address","post Code"

for each these entries there is a seperate text box . I want to change all the address text boxes to just one multiline Text box. How can i go about treating each line seperatly (just like i was doing with lots of text boxes)?

Thanks

Cliptext Naviagte Text Boxs
Hi guys

i have a problem i am trying to find a solution to - i have an exe i am trying to interact with initially i thought i may be able to navigate to around the textboxs filling with data by including vbtabs to get me to the boxs as you can on excel
but i cant seem to get it to work.

I.e


Code:
Dim ClipStr as String
ClipStr = "textbox1" & vbtab & "textbox2" & vbtab

clipboard.settext(ClipStr)


I know this is a very basic way of doing it but i am restricted as to what i can do with the systems i am working with.

I concidered sending messages to the relavent textboxs but with the limited info i have i understand that would involve loading vb onto the machine with the software in question and getting process handles and windows address's
before i could start interacting with them.

in short i want to fill in 6/7 textboxs on an exe that i have no real access to mess around with.

any help suggestions would be great
what about combining sendkeys into the clipdata can this be done?

Looking For Help With Adding Text Boxs While Running
Hello I'm making a program that searches for variables with in a flash game. I'd like to have a text box added and have the info for each variable put in the text box.

Say the program finds 60 variables I want to have my program either make the 60 text box's available to see and use or which ever way this can be done.

I know it didn't make sense.

Check Boxs And Option Buttons
How to plus values from check box with values from option buttons

Rotate Captions Or Text Boxs?
I know its been asked before, but all the previous threads about it pointed to a link that doesn't exist anymore.

Using A Combo Box To Bring Up Related Fields In Text Boxs
Ok im running a vb program in front of a access database

I want that when you choose a value from the combo box the related fields come up in the text boxes.

eg the persons name in the combo box so when you choose the name, in the text boxes if brings up the relevent address, phone, email etc, i would prefer to use text boxes to show this information, (a new text box for piece each of info)

I have a adodb connecton to the database and have called the names to the combobox but the text boxs only load up the first record

in the form load im doing this

With rsStaff
.LockType = adLockOptimistic
.Open "select * from staff", MDIMain.Db, adOpenKeyset
End With
Assigndata ' assign data to the text boxes

Do Until rsStaff.EOF = True

cmbStaff.AddItem rsStaff.Fields("staffname")

rsStaff.MoveNext 'moves next record
Loop
rsStaff.MoveFirst

cmbStaff.Text = rsStaff.Fields("staffname")

but im not sure what code to put in the cmbstaff combo box to get the text boxes to update to the appropriate combobox selection

Finding Text And Seperating It Into Diffrent Text Boxs
hello i am trying to be able to let a user type in a part number and have it desplay the stats of it i made a file that looks like this

MCE24 : 466
MCE42 : 468

the : seperating what the user types in "MCE24,30,36
" and the out put to a text box "466" and so far all i can do is only ge the whole line with this code


Code:
Dim selectedMain As String

selectedMain = Convert.ToString(lbman.SelectedItem())

Dim FileReader As New StreamReader("C:Documents and SettingsvbDesktop" & selectedMain & ".txt")
Dim FileContent As String = FileReader.ReadToEnd() 'reads the whole file into a string
Dim i As Integer = FileContent.IndexOf(txtpart.Text)
If i <> -1 Then
'the file contains the word test
'declare a string to hold the text from test to <
'take a part of the string from where test is found + 4 (length of test )
Dim Result As String = FileContent.Substring(i)
'now find where < is found in this string
i = Result.IndexOf("<"c)
If i <> -1 Then
'the result string contains <
'take the string from the beginning till the last character (just before the < )
Result = Result.Substring(0, i)
'now result contains the string you want
End If
TextBox1.Text = Result
End If
i hope someone can help me i looked all over
Edit by passel: Use [vb][/vb] tags around your code to make it easier to read.

Help With File List , Dir List And Drive List Boxes..
How do i link my drive list , file list and dir list boxes to gether , so that when i for exaple set the drive list to c: , the dir list will then give all dir in there, and file list will show me files from the directory, right now the default file list is set to my vb file list and i cant change it...

Getting A Combo Box List And Putting It In A List Box List On Another Form
I am finally writing my first MDI! I'm doing a lot better than I thought I would so far, but now I'm stuck. I need to have a list from a combo box copied into a list box on another form. I want it in the Form_Load() event. Right now I have:

Code:Private Sub Form_Load()
frmpresetedit.deletepreset.List = frmtimer1.cmbpresets.List
frmpresetedit.Show
End Sub

deletepreset is the list box, cmbpresets is my combo box.
It always comes up with a compile error at the .list part of cmbpresets.list and says that 'the argument is not optional'. What is my problem here? I'm sure this problem is simple and I'm probably just making a stupid mistake. What code do I need to use?
Thanks


Now, don't get me wrong, 'cause baseball's a great sport.
It teaches little children simple eye-hand coordination with little effort or exhaustion.

 -byufan

Edited by - byufan on 7/20/2004 4:20:57 PM

Activex Controls For List Box, List View & Combo Box (for Storing Arabic Language)
Hi all,

Can any one having controls (list box, list view , combo & date
picker ) with right alignment. i.e scroll bar should come in left side
instead of right...simalry drop down for combo box should be in left side
instead of right side.

This i need for storing Arabic data...

Thnaks
Sridhar CS

Select Folder Dialog. List All Folders And Subfolder In List View
Hello all.

I am trying to select a folder in a folder dialog. I then want it to list all the folders and subfolders and files within the selected folder in the list view.

this is what i have so far. It just lists all the first children folders of the selected folder. any help on this?


Code:
Private Sub addFolders()

FolderBrowserDialog.ShowDialog()

ListView1.Items.Add(FolderBrowserDialog.SelectedPath) 'lists top selected folder

Dim STF As New IO.DirectoryInfo(FolderBrowserDialog.SelectedPath)
Dim F As IO.DirectoryInfo
'lists each folder inside top folder
For Each F In STF.GetDirectories()
ListView1.Items.Add(F.Name)
Next

End Sub

Finding List Item As U Typed In Combo Box(Dropdown List Style).
Basically the title say it all.

When I type a letter in combo box it finds item by matching the letter that I typed, but when I type in a second letter it searchs item that starts with the second letter.

I wonder is there a way to macthing list item as u typed in combo box(Dropdown List style).

Thanks in advance.
Joon

Create A Property Window Dropdown List AKA Listbox List/ItemData
I'm trying to create an enhanced listbox control (in VB6) and one of my main criteria is to make it funtion very similarly to the standard listbox control.
Creating dropdown lists of constants (i.e. the Style property) is easy enough. but I haven't been able to re-create the ability to add (array) items in the property window such as is possible with the standard Listbox List and ItemData properties.
Anyone know how (or if) this can be done in VB6?

Regards

Ant

Create List Of Files From Folder But Allow Double Click On List Item To Run Bat
I am a newbie
But am making some progress
My next plan is to make a simple dialog with a list box and 3 buttons to do the following
List all the batch files in a folder
then allow me to highlight one item in the list so when I click the button it will run that bat file.

Sounds easy enough but I just keep hitting a brick wall and am not making any progress at all.

All help or similar snipits of code that I can re-organise will be greatfully apperciated.

Thanks in advance

HighLight List Box Selected List Item With User Defined Color
Hi Friends,

I need a help from u all. My problem is to change the Backcolor of the selected listitem of a listbox.

Let me explain detail. Normally in a listbox if we selected the list, the list item will be highlited with blue backgroud (ie. the selected item color settings of the system). Now I need to hightlight the selected list in the list box with my own color say red, green or something else.

Would anyone help me.

V.P. Vijayavel

LIST BOX HELL. Please Save, Remove Items, Many List Boxes...one Last Name
ok, so the code so far, or as much as you need to see, is
****************************
***************************
***************************
***************************
***************************

Sub LoadCal()
Dim gdtDate As Date
Dim i As Integer
Dim x As Integer
Dim startDay As Integer
Dim giMaxDays As Integer

' clear list boxes before filling again
For i = 0 To 41
List1(i).Clear
Next

' * * * * * * * * * * * * * * * * * * * * * *
' * * * * * ADD DAY NUMBERS * * * * *
'label at top of form
Label1.Caption = MonthName(giMonth) & " " & giYear

'this is the current date
gdtDate = CDate(giMonth & "/01/" & giYear)

'minus one so the first line is never completely empty
startDay = Weekday(gdtDate) - 1

'the number of days in this month
giMaxDays = Day(DateAdd("m", 1, gdtDate) - 1)

'populates list boxes with days
x = 1
i = startDay
While i < (giMaxDays + startDay)
List1(i).AddItem (x)
x = x + 1
i = i + 1
Wend

' * * * * * * * * * * * * * * * * * * * * * *
' * * * * * ADD NAMES TO DAYS * * * * *

' !!!!!!!!!!!!!!!!!check to see that list is not empty !!!!!!!!!!!
If lstAgentList.ListCount = 0 Then GoTo done
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

'agent list counter, "at which item" index
x = -1
'populate list boxes from the first day of the month with numbers
i = startDay
'counter for number of days until sunday
a = startDay - 1

'from the first day to the last day
While i < (giMaxDays + startDay)
If a < 6 Then
'a maximum of 3 names per day
While (List1(i).ListCount) < 4
' if there are no more items in the items list ('x' is greater than counter)
If x < (lstAgentList.ListCount - 1) Then
x = x + 1
' otherwise set it back to 0 (zero)
Else
x = 0
End If
'add the next name from the established agent list
List1(i).AddItem (lstAgentList.List(x))
Wend
a = a + 1
Else
'a maximum of 3 names per day
While (List1(i).ListCount) < 4
'add the next name from the established agent list
List1(i).AddItem (lstAgentList.List(x))
'here we do not increment name for it is a sunday
Wend
'reset 7 days until sunday counter
a = 0
End If
'increment day count
i = i + 1
Wend

done:
' end
End Sub



***************************
***************************
***************************
***************************
now see the shaddy thing with this is...well, it's a calendar month see, and every day is a list box....first item, the date, 1st, 2nd, 3rd, 4th, and so on...each list box can hold that first item, the date, plus 3 names.

if someone double clicks on one of those names (which are populated through other methods...not important) i want that name to be deleted...now where i am out of ideas is: how do i delete one item from one list when my list (List1) is an array of about 41 list boxes all named List1 (x) see....

also if I wanted that name which was double click to delete itself through the entire month, then ....well...the rest is my own trouble...but so far i can't seem to be able to delete.

grrr.
...

thanks in advance,
-munchkin

Excel - Dropdown Showing List 2 Dependant On What Was Chosen In List 1
I'm programming VB in Excel. I've created a series of simple lists in a worksheet. I would like to select one object from list 1 in a cell in column A and then have the cursor cell move to the right neighbouring cell and present me with a dropdown menu showing the contents of another list dependant on what was chosen in the first cell. Is there a specific command for this?

Many thanks for any help.

Editing List Items And ListSubItems In List View Control
Hi,

It is possible to edit ( add an entry ) the first column of a ListView control. By setting to automatic mode.

How do I edit the subsequent columns ( The listSubItems ).

BB

Copyright © 2005-08 www.BigResource.com, All rights reserved