Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 10-14-2003, 06:49 AM   #1 (permalink)
Junkie
 
Location: RI
CheckedListbox question in Visual basic

Using Visual Basic .NET, I'm trying to make a checked list box. Now, what I have in that list box are certain values(duh, I know), but when you click on those values, I want them to add a certain value to something. I have tried messing with a piece of code that M$ provided but I don't seem to be getting anywhere.
Some background into what I'm doing. I'm creating an area creator program for my online game. It stores this certain value in a Bit Vector(hopefully that's how they do it). So if the 3rd and 2nd item on the list are checked, it adds a certain value for the 2nd and the 3rd item to a value, then puts the value into a file. I thought the most user friendly one would be to make the checkedlist box, but if that doesn't work, I'm going to need to create a second form, but I'll need to have that form return a value to this form...
So any help is appriciated very much by myself and all those who want me to finish this damn project.
Fallon is offline  
Old 10-14-2003, 07:05 AM   #2 (permalink)
"Officer, I was in fear for my life"
 
hrdwareguy's Avatar
 
Location: Oklahoma City
So at what point is it not doing what you want it to do? Can you post some code snippits?
__________________
Gun Control is hitting what you aim at

Aim for the TFP, Donate Today
hrdwareguy is offline  
Old 10-14-2003, 07:12 AM   #3 (permalink)
Junkie
 
Location: RI
First it needs to have two variables. I'll call one value and the other total. Both are initialized at 1. I want it go thru each item in the list, and check to see if the item is checked or not. Also, when it checks I need it to also multiply value by 2, if the item is checked, add value to total. Then have it restart the loop on the next item in the list doing the same thing.
I've tried CheckedItemList.Item(x).CheckedState where x is equal to what iteration it is in the loop, but that doesn't work, and there is a CheckedItems, but that won't go thru each value to do what I need it to do.
Fallon is offline  
Old 10-14-2003, 08:00 AM   #4 (permalink)
"Officer, I was in fear for my life"
 
hrdwareguy's Avatar
 
Location: Oklahoma City
You can do this:

Code:
Dim i, value, total As Integer
        value = 1
        total = 1
        For Each i In CheckedListBox1.CheckedIndices
            value *= 2
            total += value            
        Next
__________________
Gun Control is hitting what you aim at

Aim for the TFP, Donate Today
hrdwareguy is offline  
 

Tags
basic, checkedlistbox, question, visual


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 On



All times are GMT -8. The time now is 06:01 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76