VS 2010 - Clicks The Remove Button, It Removes Random Items, Not The Selected One?
Mar 28, 2010
I have a listbox were users can add items to. Then i also have a remove button which removes the selected item. The listbox also has a datasource, so to remove an item i uses this
[code]...
But i also want sorting on the listbox. But when i clicks the remove button, it removes random items, not the selected one. How can i fix this?
i i have a listbox and 1 button in my application thing i want is when i click on some listbox item auto press that button or when i click on some item in list box it remove selected items from list box just with mouse click
I'm trying to make an application where when the user clicks a button, it generates a series of 100 random numbers between 1 and 1000, and then saves those numbers in a text file. All I could come up with is generating ONE random number, but I can't figure out how to make it 100. Here is what I have:
I'm using VB2008 express. idea for a D&D application. So I wrote something and it works, but it's not coded like I want. Here's the program if you want to see it in operation: [URL]
Here's the problem I have. I want a message box to pop up if no dice are selected and the user clicks the roll button. So far the only way I have been able to accomplish this is to put the same code under each radio button:
I want to have this code only once. But If I put it outside of the If/Then bracket and no dice are selected, the msgbox pops up but also the buttons that I want to remain hidden until dice are chosen pop up. How do I get the msg box to pop up and stop...don't execute any more code.
Heres' the code so far. trying to keep it relatively simple:
Code: Private Sub RollButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RollButton.Click 'see which radio button is checked and display random number accordingly If TwentySidedRadioButton.Checked Then RolledValueTextBox.Text = GenerateRandom.Next(1, 20)
I have a few questions. I am not understanding on how to do it.The first question is:
1.When the user clicks the button the info from the controls on the left appears in the label on the right. 2.How to retrieve the selected dates from the calendar control when the user clicks the button?
If CheckedListBox1.SelectedItem IsNot Nothing Then MsgBox("Your favourites have been saved") ListBox7.Items.AddRange(CheckedListBox1.CheckedItems) End If End Sub
What i want it to do is to add the selected items from checkedlistbox1 to listbox7 (but not remove them all together)
This is my error: Overload resolution failed because no accessible 'AddRange' can be called with these arguments:
'Public Sub AddRange(items() As Object)': Value of type 'System.Windows.Forms.CheckedListBox.CheckedItemCollection' cannot be converted to '1-dimensional array of Object'.
i want to be able to remove multiple listbox items using one button the code i have tis the following: [code] Now this removes one item from a listbox, i changed the selection mode now now i can select multiple listbox items, but how does the code differ to delete all of the items selected? As currently it just deletes the top of all the selected items!
I am wanting to display a popup menu when a use clicks the right mouse button on my ListView.I have created a ContextMenuStrip with the items I would like.
[code]...
The thing is, the menu is way up to the top left. How can I set it to be where the user presses the mouse.Also, how can I set it to pop up only when the user presses the right mouse button on the lstView.
I am wondering how i would go about taking multiple items (randomly) from a listbox and displaying them in a label!Now this listbox wouldn't have to be visible, maybe i can do it without it even being a listbox?I want to have 25 labels and each one recalls a random value from the list (doesnt matter about being unique and the list will contain about 20-30 items)Im just a bit stumped on how to do it as ive done some looking into it but most people are asking for randomized numbers or unique items where as i need randomized items from a list which aren't unique!
how to go about picking the random weapons. When you generate a random class, the user must first enter their current rank (level). This is because you are unable to use certain guns until you reach a specified level. This keeps the program from giving out guns the user can't use. What I am doing is allowing the user to give certain parameters as to what type of gun they want to use (or don't want to use). For example, I have checkboxes for the user to pick if they want assault rifles, SMGs, LMGs, Snipers, Shotguns, RPG, etc.
I did this in another version of this program I made, but the only option was to pick whether or not you wanted RPGs included. So, it was easy enough to check if the weapon was an RPG and if it was simply generate another random weapon. I could do this, but with the number of options there are, I don't think this would be the best solution.
I am making a program, and I have a listbox which will contain A big list of file Paths. I have two buttons Add and remove. Adding items is easy and I have done this. But removing items is the hard part because the listbox is multiselect. I have tried so many attempts It wouldn't be useful to post code. But the closest attempt is
I was working in a Game in VB, and I was making a Loop that will start when the game begin and end when someone win.But then I found a problem:I have my main code in the loop and a Randomizer that starts when a button is clicked.So my problem is that I can't work whit the random number in my loop. How can I access the random number (it as to be choosen after a click of a button) in my loop?!
building simple program that i could print index pictures to 11x17 size paper. and came across with listbox multi items selected and wanted to add them to different picture boxes?
I want RANDOMLY click one of two radio buttons on a web page. Right now I only know how to click the last one... Also, the value of the radio controls changes every time. HTML Code of radio controls
HTML <input type="radio" name="vote" value="ECA">Yes <input type="radio" name="vote" value="ECB">No
I'm back, and ive continued with my browser. I've added some cool new features but right now im hitting an old problem i forgot about. Basically ive added a music player to my browser. And you can IMPORT your songs. All tracks you import are placed in My.settings.music as strings. Thing is. I made a "edit playlist option". Here's what it looks like for now... It sucks i know but i wna get the coding right first.
Basically I have textbox1 and I have button1. I want it so when I press button1 it chooses a random string from these 4 strings. "dubstep","metal","hardcore","rap" textbox1.text = "***doido:L"
I have two groups of RadioButtons, each group inside its own GroupBox. When a RadioButton from one group is selected, the handler passes the selected button - this is not a problem.
But I need to grab the value of the selected RadioButton from the other group as well - is there a simple way to do that without iterating through them all?
I am just wondering how I can make a listbox count the number of selected items and display it in a text label. My listbox selection mode is on MultiExtended.
I need to create a program that when I click a button it shows a sentence (took it from a list) random. But after it have to delete the sentence from the list 'cause we dont want to read it again I don't know so much about VB so I'd like some help!
I have a listview control (lstBasket), and I want to only enable a button when the user selects an item.. If there is no item selected then the button (cmdRemove) is disabled. My program is required to remove/change the item when they select it and clcik remove. Either that or a try and catch, that will stop it from throwing errors when there is no item selected.
In my Windows Form I have a ComboBox that is filled by a Stored Procedure with a list of names. I have the Combobox set for AutoComplete to "Suggest" and From "ListItems". When a user starts to type in and the AutoComplete does not find any matches in the listitems the user can tab out of the ComboBox and leave what they typed in the combobox even though it is not one of the Valid Items. Is there a way to check the Comboxbox to make sure of of the selected Items has been selected?