|
You'll need to add each textbox to a list and then randomly select which one you want. Once you pick the textbox you set the text and remove it from the list so it's not chosen again. This should work for you.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'This list will contain our textboxes
Dim itemList As New List(Of TextBox)
'Add each textbox to the list
itemList.AddRange(New TextBox() { _
txt1, _
txt2, _
txt3, _
txt4, _
txt5, _
txt6})
Dim rnd As New Random 'Random number generator
For i As Int16 = 0 To lstListbox.Items.Count - 1
'Pick a random textbox
Dim index As Integer = rnd.Next(0, itemList.Count)
itemList(index).Text = lstListbox.Items(i).ToString
'Remove the textbox so we can't pick it again
itemList.RemoveAt(index)
Next
End Sub
You can write a small routine that dynamically adds each textbox to the list instead of hardcoding them in there, but if you know you'll just want to popullate these 6 you don't have to go to the trouble.
|
|
|
|
|
Brilliant, it works a charm!
Thanks a million TwoFaced!
|
|
|
|
|
where i create internet dialup connection programatically
|
|
|
|
|
i want to create a log file in the dtabase project to ensure the security
|
|
|
|
|
cicandre wrote: i want to create a log file in the dtabase project to ensure the security
Good for you. Did you just want to tell us this? Or, do you have a specific question?
|
|
|
|
|
Is it possible to write a VB program to shutdown your PC or a PC on the network. I use XP and .net 2003.
Any ideas?
|
|
|
|
|
|
I use a desktop icon that could easily be used as "process.start(shutdown.exe -s -t 00)"
Shutdown: %windir%\System32\shutdown.exe -s -t 00
Restart: %windir%\System32\shutdown.exe -r -t 00
Logoff: %windir%\System32\shutdown.exe -l -t 00
Hope this helps!
|
|
|
|
|
In vb.net when i bring a date and time over from the database it sets it up in the datagrid as 30/12/1899 it is meant to be a time but when i click on the datagrid it puts the time into the text box but i need the time to be showing in the datagrid for some reason it is showing a date. any solutions.
|
|
|
|
|
You are pulling it as a time and just binding it to the datagrid with no formatting? The datagrid should just show what you give it unless you have setup a format.
Cleako
|
|
|
|
|
just have time in database 19:30 and then pullit to datagrid but it shows a date in datagrid 30/12/1899 and then when i select a row from the datagrid to populate the text boxes it pulls the time i am a little confused but have not set any format for it.
|
|
|
|
|
I m working on a module where I fetch the table information from database, and display it in Datagrid.I am able to view all the records.
Actual procedure is :
User selects from the list of tables in the database, then select the operation to perform(Ex add, update,del,view) then that table information is displayed accordingly in the datagrid. At runtime the recordsource for the datagrid changes to the name of the table selected from the list.
Now when I do update to a table with non-numeric information i get the following error.
[Oracle][ODBC][Ora]ORA-01461: can bind a LONG value only for insert into a LONG Column.
This error I searched on Internet, it says to check for any data conversion that is done in the coding. But I have only fetched the data in Adodc & updated there itself.
Can any one help me to solve this problem.
Upma
-- modified at 5:45 Wednesday 21st February, 2007
|
|
|
|
|
Hi Upma,
The conversion in your case is implicit.
Upma wrote: Now when I do update to a table with non-numeric information i get the following error.
You are trying to convert a long to a string. You should probably set the column in the table to long.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
dataadapter update method problem
sanjiv raj rao kusuma
|
|
|
|
|
sanjiv raj wrote: dataadapter update method problem
Care to give us more details about your "dataadapter update method problem"? It is very difficult to help with so little information. It is like phoning a mechanic and saying "car driving problem"
|
|
|
|
|
i cannot add reference file "csMusicMedia.dll" into my VB.NET application as a library file.
the error says,
"this is not a valid assembly or COM component. only assemblies with extension 'dll' and 'COM' components can be referenced. please make sure that the file is accessible, and that it is a valid assembly or COM component."
but the .dll file i using ia a valid library file.
|
|
|
|
|
siva503 wrote: but the .dll file i using ia a valid library file.
"library"? C and C++ produce libraries. .NET languages produce assemblies. You cannot add a library file to a .NET application unless you use DllImport.
|
|
|
|
|
does anyone knows on how to disable local area connection progmatically?
|
|
|
|
|
Hi All,
I need to add a help file within my system (i.e: steps to use the system), I have searched in all items imbedded within VS 2005 but I did not file item like help file. Is there any body who may help ???
Kind Regards
OBarahmeh
Palestinian Central Bureau of Statistics (PCBS)
Ramallah-Palestinian Territory
|
|
|
|
|
You have to install the MSDN Library to get the documentation. This comes with every version of Visual Studio, except the Express Editions (I think! - I don't use them).
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
When I send the data to the server, the server forms an xml of the data and sends me the url to that xml.
Now, I am needed to save this xml into a particular directory(already known).
How to I read and save this file ?
I am not having a trace of the flow with me, so I dont have an idea how I will get the data in the xml and furthur will save it.
Can anyone help me to know how can I read the xml from the url to the xml and how do I save this file into a directory
|
|
|
|
|
using a Sql Server DB , and having a field 'ID' with a 'varchar' datatype,
how can i set the criteria of this field to be : unique No dupplicatate (like MS-Access)
to dissallow the user to enter the same value twice
thx
Regards
Ramy
|
|
|
|
|
you can set the primary key for that field so that you can prevent the dupliacates
Sathesh Pandian
|
|
|
|
|
sathesh_pandian wrote: you can set the primary key for that field so that you can prevent the dupliacates
Which is not a valid thing to do if you already have a primary key! Do NOT set a column as a primary key just to make it unique. There you can apply a unique constraint to columns.
|
|
|
|
|
When you create your table you can do something like this:
CREATE TABLE dbo.MyTable
(
MyUniqueColumn varchar(30) NULL UNIQUE NONCLUSTERED
)
|
|
|
|