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




Two Q's - Changing Tab Order && Getting A Random Variable To Show Up At Another Text B


1. I have 20 text boxes.. they are each named p1-p20. How can I make it so the tab order goes through them in order (1-20)?

2. I have this code:

When I press a button (pickwinner) I want the text inputted in one of the twenty text boxes that I have (p1-p20) to display in the text box called winner.text.. How can I do this? Thanks!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing The Order Of Text
hi

need a quick help on changing the order of text in textbox

apple
orange
mango
pineapple

to this rev order

pineapple
mango
orange
apple


thanks for helping

Need Help - How To Show Random Text
Hi all, good day!

I have a problem with vb6. I need to show random text in a lable or text box. that means, If command1 button click text box show another text from predefined text list. this must show when program start also. I mean,

ex: If user open once it display "Hello" after that he open the program in next time it will display "Howdy" etc.

Random text is must in the program like

Hello
Howdy
LOL

I am so confusing of this. Please some one help me. I am a new comer to vb6. I need your help please.

Thanks & Have a Nice day!
gymamal

Kinda Stuck... {show Random Text From List}
Hey guys im kinda stuck. I am trying to make a random insulter in Visual Basic 6.0 and i want it to be able to say a difforent insult out of the 100 that i put into the code every time i click the command button. I want the insult to come up in a text box.

I hope you guys can help me.

Thankyou.

Changing A Line Of Text Within A Variable....
How do I change a word x from inside a variable that contains this sentence and then make it bold type( like in html )? The catch is that x can be varying lengths. The consistent thing is the ( after the x.

x(this is a test)goodbye

Order By Date(text Data Type In Access Mdb) Is Not In Proper Order
Friends,

I am using crystal reports 9 with vb6 and the db is ms-access 2002.
I am just adding the "tbltime" table to display all the fields in the crystal reports.
In the "tbltime" table a column called logdate which is of text datatype in the database.
when i view it in the report the result is not in the proper order but in the database table it is in the ascending order.

logdate in TblTime in dd/mm/yyyy format:

01/09/2005
02/09/2005
03/09/2005
01/10/2005
02/10/2005
01/11/2005

when i view in the reports the logdate field is displaying like this.....

01/09/2005
01/10/2005
01/11/2005
01/11/2005
02/09/2005
02/10/2005
03/09/2005

what to do now?

Thanks
Sathyguy

Random Order
I am now trying to make the order of which the records appear random in a database. Any idea how to do that?

Random Order
I am making this game where I need to put 26 values in a random order... The problem is that I don't know how to check if the random number generated has already been generated before or not... Even a bigger problem, I don't know how to make the loop so that when all the values are assigned, the do loop is exited...
Any clue on how this could be done...

Random Order
I want to be able to rearrange the items in my ListView in a random order. Any ideas how to do this?

Random List Order
can i randomize the order of a list?

Random Order Fixed?
I don't know why

dim a as integer
a=int(rnd*10)
msgbox a

each time the result is
7.055...
5.334...
5.795...
etc...

no matter I close the program then restart,or close vb then restart
it's fixed to this kind of order
0.7055...
0.5334...
0.5795...
etc...

N Numbers In Random Order
well lets say I have 10 questions and I want them to show all in a form but in a random order... each time the form loads.
How can this be done? (more accurately 10 fields to get an answer "seeing" in ten fields of a table and I want to read them each time in a random order. So another difficult - for me - part is to save all the correct answers to the correct fields)
As you can understand I'm a vb rookie so please try to be clear + suggest any e-tutorials or handbooks u know!
I want to use the code I'll try to make in a MS access database!

Forgive my bad English. I'm greek and I'm doing my best in being understandable!

How To Display In Random Order? Please Help
I'm working on a testing program.

I need to take answers from a database and display them in a random order.

Lets say there are fields named ans1 ans2 ans3 and ans4.

Ans1 will always be the correct answer. I need to display each answer in a random order every time.

I'll appreciate all help.

How To Organize The Data Show Order?
Hi:

I'm using the code:

-----------------------

Set TelComCad = OpenDatabase("s:TeleComCadTelComCad.mdb")
Set ExtPhy = TelComCad.OpenRecordset("Select * From ExtPhy Order By ????Dnr?????", , dbOpenTable)

-----------------------

What's the option to organize the numbers in increasing order?

Very thanks.

How To Organize The Data Show Order?
Hi folk:

I'm trying to use the Data Object, the problem is how to make it organize the table in alphabetic order or in numeric order instead of record order?

I got a book that tells me to put a crazy command that don't work.

Thank U.

Forum Order Changing...
There is still always almost double the amount of people in the Classic vb forum.

Changing The Order Of ONE Record
From a SELECT statement, can I say SELECT 10 records BUT take the last record and put it on the TOP of the result?

example:
12345678910

change to:
10123456789

Thanks

Changing Tab Order W/Tab Strip
I have a form which has a tabstrip control on it. On a tab I have multiple other controls - text boxes, combo's and check boxes.

When I use the TAB key through all the controls on the tab it follows through using the tab indexes just fine. However when use the TAB key and I reach the last control on this tab I want the focus to return back to the first control on that tab.

I've tried using keypreview on the form that the tab control is on and hitting TAB doesn't trigger key down, key up or key press. Lost focus is triggered on the last control but if I use setfocus to direct the focus back to the first control it messes up when using the mouse.

What can I use to check if the TAB key has been used and direct the focus to another control?

Need Listbox That Allows Changing Order Of Elements
Where can I find a listbox control that lets the user change the order of the elements? (either by drag/drop or clicking up/down arrows?) Is this one of the controls included in VB5/6?
thanks!

Changing Sort Order On Combo Box
I need to sort a Combo Box list in descending order. Currently, the list is sorted, but the lowest(and oldest) values are shown first. Over time, the list has grown to several thousand entries, but only the most recent values are worked on frequently.

Is there a way to change the sort order, perhaps through an API call? I could sort the values myself before plopping them into the Combo Box, but it would take some significant code changes.

Changing Sort Order In Listview
I have a listview and some data being shown. I would like to allow the user to change the sort order by clicking on the columns.

Is there any way to do that? A lot of applications do so i guess i could do that.


Thanks in advance.

Changing String Order At Runtime
i am working on a web interface procedure.
i am trying to build an HTML table one row at a time.
everything works ok, by i am interested in changing the order of the colums according to a theme, or templete.

the row is built by stiching together colum strings from a UDT like:

htmLine = tmpHT.head & tmpHT.type & tmpHT.date & tmpHT.size & tmpHT.file & tmpHT.foot

how can i change this order at run time?
i would like to avoid a 16-way select case, and i would like to ability to omit one of the colums. whatever setting i use would be used for the entire app execution, and i have profiles from an ini file that loads at the beggining, so different patteres could be included in the profile.

i was thinking something like call by name or dimmming a control, but to no avail.

Any Suggestions?

Changing Order Of Form Appearance
i was writing an app with one form (form1 for arguments sake)

then i realised i needed the user to vcerify a password

i added a frmlogin but

my question is this (and i'm sure it is really simple)

how do you change it so that my new form (frmlogin) is the first to be displayed rather than form1. (cos at the moment when i run the project it is form one that is visible first

Need Listbox That Allows Changing Order Of Elements
Where can I find a listbox control that lets the user change the order of the elements? (either by drag/drop or clicking up/down arrows?) Is this one of the controls included in VB5/6?
thanks!

Changing Order In Which Childcontrols Are Stored
hi all,

i have a 'container' ActiveX control, on which existing ActiveX controls can be placed.

When you place controls onto the container VB keeps track of them, and when you switch states between design- and runtime mode VB loads- and unloads these 'child'controls automatically. It does this in the order you placed them on the container.

There is a need to change the order in which the 'child'controls on this container are stored and retrieved.
The problem is that i cant find a way to manipulate the order in which these controls are loaded and unloaded. Can anybody help me?

Has anybody ever attempted something like this before?

thanx to all

CLOSED - How To Show The Sort Order On Listview Column Header
Hello outthere!

Using the first time a listview in an app, I wonder if there is a way to show the sort order on the column headers like Outlook does.

Thanks in advance for any idea!

Wolf

Changing Object Layer Order In Run Time.
I'm trying to draw a number of lines in run time onto my form but they keep being hiden behind lables and pic boxes that are also drawn in run time. I've tryed changing the order in which they are created but they still seem to fall behind the other objects.
Is there a way of making them apear on top by using an extra comand when created in runtime or is it posible to draw them in design mode and setting them to always remain on top?

SSTab For VB6 (changing The Order Of Existing Tabs)
I have a form with 5 tabs (using SSTab) and I have made some changes in my code and I need to switch the 4th and the 5th tabs. I cant seem to find anything online or in the help library to show me how to do it. For some reason I think I have done it before, but I cant remember.
Thanks,
Gary

Create A Text File From A Mulitline Text Bo In The Same Line Order Of The Text Box.x
I read a mulitline text file to a text box via:
(txtCurrentINI.Text = Input$(LOF(15), #15)

I would like to be able to change lines in the text box-- then
write to a new file.

What would be the proper instruction and syntax to use?

Show Random Pictures In A Form
I, first at all, excuse me for my bad english.
I'm doing a quiz game, and every time a load a form, called frmplayer1, i want the imgplayer1 show random from a folder with various gif's.

Example: the form of 1 player load and my character is a doctor. But i have a folder with other images (gif). I want the game choose random my character.

Thanks.

Random And Sequential Slide Show
I am having trouble with this random and sequential slide show code, it reads the stored array elements, and creates a slide show with it. Here is the code. Disregard the commented out code.


Private Sub fsequential_Click()
showType = "Sequential"
Timer1.Interval = 5000
End Sub
(the same is for a random button)
Private Sub Timer1_Timer()
If showType = "Sequential" Then
Image1.Picture = LoadPicture(myphotos(i).Location)
i = i + 1
If i > nPhotos Then i = 1
End If
'If showType = "Random" Then
'Image1.Picture = (Rnd * (myphotos(i)))
'End If
' another if block for Random ShowType
'End If
Call Showimage(ind)
End Sub

Sorry for the long post

Show Random Stored Number
I have a button and a text box, I want it so when they click the button one of the group of numbers I have stored in it will show.

So lets say I have theese numbers as an example: 32154, 76783 and 11215, I click the button and than the number 76783 comes up, so I click the button again and I get 32154 I click again and I get 11215 and I click again and I get 32154 again since it only has those 3 groups.

I was thinkin maybe variables? and sum how set it to randomly show? I dont know howto exactly, I am sure it has been done before though.

XP Vs 98 - Random Variable Changes
I have searched this site for a few days now so I do hope I am not repeating a past question.

My application uses the following array:

Totals(7000) as integer

It keeps a running total and works well on XP.

When run on 98, the application seems to generate completely random entries making the data unusable and then causing run time errors (usually overflow).

I have placed numerous debug statements into the code and run on both machines in the development environment and get the same error with absolutely no logical explination why it does not work on 98 but it is okay on XP.

Any advice would be greatly appreciated - I am completely lost.

Blaine

Random Refresh Of Drawing Surface Causes Background Color To Show
I'm using directdraw7 to display my game. I'm having an issue when the game is windowed.

My render chain works like this: back buffer->front buffer (associated with picturebox)

I've just noticed that occasionally - say, once every ten seconds, the picturebox that I'm blitting to will 'refresh' and re-paint itself... displaying the background color that is normally behind the game graphics.

Is there a way to stop this from happening?

Alternatively, I suppose I could use the BltToDC function, and draw directly from the back buffer to the picturebox... is this slower than the normal process?

Adjusting A Random Variable?
Hello everyone,

This one will hopefully be a simple one, but I'm having trouble getting my brain around it. There are a number of variables that I would like to make a function that adjusts them as I need to throughout the body of my code. Each variable has a minimum and maximum range, specified by other parts of the array.

For example:

Stat(3,10) = current value
stat(3,9)=maximum value
stat(3,8)=minimum value

Now, whenever I modify a value, I have to do it with a rather blocky chunk:
Example: I want to raise stat(3,10) by 10, but I need it to remain within the range specified by stat(3,9) and stat(3,8). Now, I'm doing:

stat(3,10)=stat(3,10)+10
if stat(3,10)>stat(3,9) then stat(3,10)=stat(3,9)
if stat(3,10)<stat(3,8) then stat(3,10)=stat(3,8)

As you can see, this beomes a bit cumbersome after doing it 500 times in code. I thought I could make a function like this:

Function Adjust(variable,adjustment)
where adjustment affects variable, then checks it against the values stat(X,9) and stat(X,8) to make sure that the modified stat(X,10) is within the correct ranges.

So, instead of all of that mess above, I could just type in:
Adjust(stat(3,10),10)
and the function would do it for me.

It's probably really simple, but I can't seem to get a function to work the way I want it to. I am using Visual Basic 6.0. Please let me know if you need any more information, and thanks in advance!

Problem With Random Variable Math
Heres my assignment please help me get a jump start as im stuck.

You are to generate a math practice drill for elementary school students. These students need to practice their addition, subtraction and multiplication skills. The user will select the type of drill (enter either M for multiplication, S for subtraction or A for addition in a text box); the number of problems they wish to do (between 1 and 20 in another text box); and the high and low range to use for the drill (lowest number text box and highest number text box).

Once user clicks the Start button, check to make sure all the values in the text boxes are entered correctly (correct alphabetic letter or numeric and within the ranges specified), display any error messages precisely indicating what is wrong in a Message label (one error per line) for each mistake and exit the click procedure resetting all the textboxes. If everything is correct, generate 2 random integers and display the problem with the appropriate symbol in an InputBox. Check the answer entered and keep track of how many correct answers are given. Continue generating new random numbers for the number of problems the user specified. When all the problems are answered, display the percentage correct in the Message label and exit the click procedure.

Here is my code so far

Code:
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

Dim strMath As String
Dim intLow As Integer
Dim intHigh As Integer
Dim intNumProb As Integer
Dim rndGenerator As New Random
Dim intNum As Integer
Dim intNum2 As Integer
'Declare variables

strMath = txtMath.ToString
intLow = Convert.ToInt32(txtLow.Text)
intHigh = Convert.ToInt32(txtHigh.Text)
intNumProb = Convert.ToInt32(txtNumProb.Text)
intNum = rndGenerator.Next(intLow, intHigh)
intNum2 = rndGenerator.Next(intLow, intHigh)
'Assing values to variables

If intNumProb < 1 Or intNumProb > 20 Or Not IsNumeric(intNumProb) Then
MessageBox.Show(" Data must be a number between 1 and 20")
End If

If Not IsNumeric(intLow) Then
MessageBox.Show("Data must be numeric")
End If

If Not IsNumeric(intHigh) Then
MessageBox.Show(" Data must be numeric")
End If

Select Case strMath
Case "A"
InputBox(Convert.ToString(intNum + intNum2))
Case "M"
InputBox(Convert.ToString(intNum * intNum2))
Case "S"
InputBox(Convert.ToString(intNum - intNum2))
Case Else
MessageBox.Show("Value must be A,S or M")
End Select

End Sub
End Class

Random Variable-count Numbers
What I mean is I have a program that adds bulk users to a domain in the main server for my dad. The problem is he tells me now he needs the lenght of each random number to be user defined. How can I go about doing this. Cint(rnd * (txtount * 'This is where I get lost.)). So basically I need to create random numbers of equal lenght that the a textbox defines.

Can We Show Form From VARIABLE ?
example i have form frmTblCountries and frmCountries i want it to open by using code


Code:
load "frmtbl" & me.caption
it error require object

or this way i cant to

Code:
controls("frmtbl" & me.caption).show

if i want to using variable to open form how do i do ?

Random && Not Random Text Into Textfile
I'm trying to make a program so, when the RUN button that I make is pressed, it outputs text to a text file every 10 seconds. An example of this text is:

admin forceclass 1 ak
admin forceclass 2 rpg
admin forceclass 3 g
etc...
etc...

There are THREE sections to the output though. The "admin forceclass" never changes. The #'s need to start at 1 and increment up to 16 at least. In the 3rd column, I need ONE of the many combinations selected randomly. The letters "ak", "rpg", and "g" all represent guns in the game. There are MORE than just 3 but this was just a small example of the output.

More over .... I want to create a SETTINGS window so that people can SELECT the guns they want to have randomly generated. I play America's Army so this program will allow me to play round after round with my clan mates and just have fun by using random weapons.

I created another topic but I'm not getting ANY feedback on it and would LOVE to get this project going but have been out of VB for a while and have forgotten quite a bit of stuff.


If you have any questions about what I'm trying to make, PLEASE post and ask as I check back often.

I was thinking I'd have to setup an array of some sort for the gun names but I'm not too sure ..... Any help would be GREATLY appreciated!!

THANKS!!

Random Number Fuction If (variable)= True
Guys,

This question may sound complicated... And I was hoping it's possible to do it. what I wanted is to have random number to change when variable is true or 1, then change the random number can change back to original when variable is false or 0 for example here's snippet:


Code:
Dim Lucky as Byte
Dim LuckyNum as Variant

If Lucky = 1 Then

Lucky = 258 + 2 + 4 - 1

else

Lucky = 258 - 2 - 4 + 1

End If

LuckyNum = Lucky
Print format(LuckyNum, "000" ' If true Print will show 263 otherwise it will go back to number 258

I have tried this similar code using command1 button as if I pressed to be true, and I end up with overflow and could not understand why, Also, I was expecting number to increase sequently in delay time for instance when its true or 1, the display will show 258,260,264 then 263. When its false or 0 it will countdown sequently 264,260,258 and etc. Perhaps, I have done wrong or anything. done search on this site seeing if anyone ever encountered or trying these methods... and end up with no luck. Can anyone help?

Fill Variable With 1 MB Random Data Quickly
Greetings!

I have seen many file wipers which can delete large files (5 MB and greater) in less than 10 seconds. Most of them overwrite the data with random characters.
I just tried to create such a program in Visual Basic, but it takes ages to fill 1 MB with random data.

Do you know how to create a variable containing random data quickly?

Here is the code I am using (which is terribly) slow:

Code:
Dim i As Integer
Dim lFileSize As Long
Dim lParts As Long
Dim lRemainingBytes As Long
Dim saBitPattern() As String
Dim sBitPattern As String
Dim sFileName As String

On Error Resume Next
With cdlMain
.CancelError = True
.DialogTitle = "Open File"
.Filter = "All Files (*.*)|*.*"
.Flags = cdlOFNHideReadOnly Or cdlOFNFileMustExist
.ShowOpen
If Err.Number = 0 Then
sFileName = .FileName
lFileSize = FileLen(sFileName)
lParts = lFileSize / 1048576
lRemainingBytes = lFileSize - (1048576 * lParts)
For i = 1 To lParts
sBitPattern = ""
Do Until Len(sBitPattern) = 1048576
DoEvents
sBitPattern = sBitPattern & Chr(Int(Rnd * 255))
Loop
saBitPattern(i) = sBitPattern
Next i
sBitPattern = ""
Do Until Len(sBitPattern) = lRemainingBytes
DoEvents
sBitPattern = sBitPattern & Chr(Int(Rnd * 255))
Loop
Open sFileName For Binary As #1
For i = 1 To lParts
Put #1, , saBitPattern(i)
Next i
Put #1, , sBitPattern
Close #1
Kill sFileName
Else
Exit Sub
End If
End With

How Do You Assign A Random Number To A An Integer Variable
Code:
Randomize
A = Rnd(9)
B = Rnd(9)
C = Rnd(9)
D = Rnd(9)
E = Rnd(9)
F = Rnd(9)
G = Rnd(9)
H = Rnd(9)
DoEvents

That's what I have and all it gives me is 0 and 1

Request A Variable From VB And Show It On Webpage
Hello Everyone,

How do a webpage capture a variable from a VB program?

For example,
I,m using ASP for my webpage.
There is a variable in a VB program that i need to capture, and show the value at my website..

I need to know which component to use?

THanks in a million...........

Regards,
Lawrence

Using The Show Method When The Form Name Is A Variable
I need to allow a user to select a form (to display) from a listbox.

The problem is I do not know how to reference the form name from a variable.

The formname is formOne, formTwo, formThree, etc based on which line of the list box the user selects.

The method I use now is


VB Code:
if listOfForms(listIndex) = 0 then     formOne.Show else if listOfForms(listIndex) = 1 then     formTwo.Show elseif listOfForms(listIndex) = 2 then     formThree.Show    ...etc   ...etcendif


I have to believe there is some way that this code could be simplified like:
listOfForm.show (which doesn't work)

(and what would happen is the selected text in the listbox ("ie. formTwo) would then make the form load and show.

Any ideas ????

Global Variable Doesn't Show Up
Can anyone think of a resaon a global variable will not show up on one form in a app when its available to all the other forms?? nothing else in the app is named the same and the syntax is correct...... I've even tried to just get it to print to a text box and even that doesn't work!

Cujo

How Do I Show A Form Without The Parent Form Showing At Top Of The Z-order
How do I show a form without the parent form coming to the front of the z-order.

i.e.

frmParent is restored but behind another application. I then execute the following code.


Code:
frmchild.visible = True


The frmParent does not come in front of previous app.

Random File Access With Variable Length String
Is it possible to use random file access with the open and get statement using variable length string instead of a fixed length string?

I have tried several variations and options to get this to work, but I can only read the data into a string if it is fixed length and the same length as the len parameter of the open statement. I have found the use of the open and get statement to be the most responsive in moving around each record and jumping to the last record. I have also tried the FSO object and input function. Although they worked and you could move around in the flat file, when you went to the last record it took a long time. (depending on record size and quantity of records - used skip with FSO and seek with input)

The objective is for the user to determine the length of each record in the flat file, after initial viewing and then changing the record size to the correct size.

Is their a better object to use or an additional method I may have missed?

Thanks!!

Help Please! {show A Form Based On String Variable}
Hello people,

I have a problem i have only been doing Vb at college for a year, im making a program for my sister so she can help teach laugauges to ppl.

Anyhow, How do I do the following:

FormNo = Combo1.listindex +1
FormName = "Form" + FormNo

Private sub FormSelect_click()
FormName.show
end sub

as you can see im trying to make a variable that i can use instead of writing

If combo1 = 1 then
Form1.show
elseif combo1 = 2 then
Form2.show
Else
Form3.show
end if

The reason I don't want todo it this way is because if I wish to add more forms for them to select in the future I have to constantly keep updating this and if it gets up to say 20 forms this is going to wast a lot of code when i could do a way like I wrote.

The thing is it keeps saying debug because it can not find the form called FormName, so how do i stop this and make it so the program reconize that its a variable not form name.

Variable Values Won't Show In Step Mode
When running an app from the IDE in step mode you can hover the mouse over a variable's name and its value shows up as tooltip text. The problem is it wasn't working for me today and I don't have a clue.

** RESOLVED ** Show Form Based On Variable
May be simple, maybe not...

I have a grid that I am populating with records from the db. The row is 2 columns. Column 1 is a form name, column 2 is a description. When the user clicks on the row, I want to show the form they selected. Here is what I have so far...


VB Code:
Private Sub fgrd1_Click()Dim form As Stringfgrd1.col = 0form = fgrd1.Textform.ShowEnd Sub


Any way to do this without a massive Select block?









Added green "resolved" checkmark - Hack

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