|
-
Oct 8th, 2006, 12:39 PM
#1
Thread Starter
Junior Member
[RESOLVED] stop items duplicating
I have a project due for college tomorrow,its an IT job finder project..so far I've coded the command buttons,textboxes,checkboxes etc,so anything the user inputs on form1 will be printed off on form 2...
Im stuck on the listbox and combo box ......I have 1 combobox which displays three jobtypes ...Permanent,Full time and Part time,once the user clicks on any of these a listbox with 5 jobtitles should appear in the listbox to the right of the combo box....
VB Code:
Private Sub Cbojobtype_Click()
If Cbojobtype.Text = "Full Time" Then
lstjobtitle1.AddItem "IT Manager"
lstjobtitle1.AddItem "IT Sales Executive"
lstjobtitle1.AddItem "IT Field Technican"
lstjobtitle1.AddItem "IT Procedure Director"
lstjobtitle1.AddItem "IT Director"
ElseIf Cbojobtype.Text = "Contract" Then
lstjobtitle1.AddItem "IT Auditor"
lstjobtitle1.AddItem "IT Project Manager"
lstjobtitle1.AddItem "Operations & IT Coordinator"
lstjobtitle1.AddItem "Service & Support Manager"
lstjobtitle1.AddItem "Senior Engineering Manager"
ElseIf Cbojobtype.Text = "Part Time" Then
lstjobtitle1.AddItem "Ecommerce consultant"
lstjobtitle1.AddItem "Network Engineer"
lstjobtitle1.AddItem "Programmer"
lstjobtitle1.AddItem "Test Analyst"
lstjobtitle1.AddItem "QA Manager"
End If
End Sub
Private Sub Form_Load()
Cbojobtype.AddItem "Contract"
Cbojobtype.AddItem "Full time"
Cbojobtype.AddItem "Part Time"
End Sub
my problem is that when i click on say Contract for example....the 5 jobtitles appear fine in the listbox..but if i click contract again..the items for contract duplicate ...so I end up with
IT Auditor
IT Project Manager
Operations & IT Coordinator
Service & Support Manager
Senior Engineering Manager
IT Auditor
IT Project Manager
Operations & IT Coordinator
Service & Support Manager
Senior Engineering Manager
items repeat over and over again........
so my question would be how would i stop these items duplicating?...and how would i go about clearing a listbox when i switch over to another jobtype..like permanent...because contract jobtitles remain when i switch...
(ps)ive only been using VB6 for about 3 weeks now,so I apologise for my lack of knowledge...
thanks for anyones input.
Last edited by MartinLiss; Oct 8th, 2006 at 01:04 PM.
-
Oct 8th, 2006, 12:45 PM
#2
Re: stop items duplicating
Welcome to VBForums! 
You'll have to clear the list before adding new items:
VB Code:
Private Sub Cbojobtype_Click()
[B]Cbojobtype.Clear[/B]
If '...
-
Oct 8th, 2006, 01:05 PM
#3
Re: stop items duplicating
I added vbcode tags to your post to make the code look more like vb code.
-
Oct 8th, 2006, 01:26 PM
#4
Thread Starter
Junior Member
Re: stop items duplicating
Martin sorry for not using vbcode tags,I will in future..
Gavio...thank you very much for the reply ,Im not really sure how to code that..tbh .but I'll play with it for a few more hours...thanks though I appreciate the help.
-
Oct 8th, 2006, 01:32 PM
#5
Re: [RESOLVED] stop items duplicating
what gavio meant was:
VB Code:
Private Sub Cbojobtype_Click()
[B]lstjobtitle1[/B].Clear
If Cbojobtype.Text = "Full Time" Then
'etc.
-
Oct 8th, 2006, 02:08 PM
#6
Thread Starter
Junior Member
Re: [RESOLVED] stop items duplicating
VB Code:
Private Sub cboJobType_Click()
lstJobTitle.Clear '====Clears the list before adding items===='
If cboJobType.Text = "FULL TIME" Then
lstJobTitle.AddItem "IT Manager"
lstJobTitle.AddItem "IT Sales executive"
lstJobTitle.AddItem "IT Field technican"
lstJobTitle.AddItem "IT Procedure director"
lstJobTitle.AddItem "IT Director"
ElseIf cboJobType.Text = "CONTRACT" Then
lstJobTitle.AddItem "IT Auditor"
lstJobTitle.AddItem "IT Project Manager"
lstJobTitle.AddItem "Operations & IT Coordinator"
lstJobTitle.AddItem "Service & Support Manager"
lstJobTitle.AddItem "Senior Engineering Manager"
ElseIf cboJobType.Text = "PART TIME" Then
lstJobTitle.AddItem "Ecommerce consultant"
lstJobTitle.AddItem "Network Engineer"
lstJobTitle.AddItem "Programmer"
lstJobTitle.AddItem "Test Analyst"
lstJobTitle.AddItem "QA Manager"
End If
End Sub
thanks bushmobile...I think I got it now..
thanks for everyones help
much appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|