Please i dont know how to bubble sort using the command buttons to swap textboxes from 1- 5.

Recommended Answers

All 11 Replies

Copy the text boxes into an array. Sort. Write the array back into the Text boxes.

bubble sort using the command buttons to swap textboxes from 1- 5.

What exactly do you need here?

Bubble can mean a lot, swap text boxes even more, swap to what.

Give us what you need and we might be able to help.:)

swap textboxes or value in texboxes?

Thanks for the reply this is the main question.
i was told to make 5 textboxes in a array form and 2 command buttons,and the command buttons will be named sort ascending and sort descending,so i will write a code to use the command buttons to the sort the textboxes in ascending and descending order.

If you say "sort the textboxes" are you talking about the text contained inside them? I am still confused.

Array textboxes will be Text1(0), Text1(1) etc. The sorting part you need to elaborate on.

I don't see what's so hard to understand.
There are 5 text boxes, each with some text.
There is a command button labeled ascending.
Click this button and the
-- first checkbox contains the smallest ordinal value of the 5.
-- second checkbox contains the next smallest ordinal value.
-- etc.

ruudycruise, based on your second post, my suggestion didn't help?

This is the full question: Mark textboxes in an array & make also two command buttons(not in an array) name the command buttons as (1) sort ascending (2) sort descending.
Code the above command buttons such thta by clicking on sort ascending then the text of numbers entered in the textboxes should get in ascending order and when you click on the the descending order to do same also.

Three post -- each one a description of what you are trying to do.
No acknowledgment that someone tried to help.
No answers to the questions asked.
Obviously not interested in help.

On to the next person. Hope he actually wants help.

Tsk tsk tsk...

Use the following as a sample and just reverse it to do the descending -

Private Sub Command1_Click()

Dim x As Integer, y As Integer

If Text1(0).Text = 1 Then
Text1(0).Text = 5
y = Text1(0).Text + 1

For x = 0 To Text1(Index) - 1
Text1(x).Text = y - 1
y = y - 1
Next x
End If
End Sub

I tried your code sir... but unfortunately it didn't work..
I'm using VB 6.0 .. I'm New in VB so I'm still searching and studying it..
every time I click the command button it always says this " Wrong Number of argument or invalid property assignment"
I'm working on it now.. but I still fail to run it successfully..
Thank you sir!

@Monique,

This thread belongs to a different poster AND it is more than a year old!!

Being a new poster I can almost understand why you posted here. :) Please open your own post from HERE and please tell us in detail what it is you are having problems with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.