Lubracali
Guest
Hello, everyone.
I'm developing a project and I'd need to create a command that tracks the values in 8 textboxes and tell me how many different values are there.
for example if the values are (1 - 2 - 2 - 1 - 3 - 5 - 1 - 3) the msgbox should say "4" as the different values are (1,2,3,5).
it will be inserted into a more complex project, but for now I have created a simplified project to study the problem, but I can't get out of it.
I created 8 textbox and a commandbutton, whose code is
the problem is that so counts how many times the values are different between them and not how many values are different.
I hope someone can help me or even just advise me on a road
I'm developing a project and I'd need to create a command that tracks the values in 8 textboxes and tell me how many different values are there.
for example if the values are (1 - 2 - 2 - 1 - 3 - 5 - 1 - 3) the msgbox should say "4" as the different values are (1,2,3,5).
it will be inserted into a more complex project, but for now I have created a simplified project to study the problem, but I can't get out of it.
I created 8 textbox and a commandbutton, whose code is
Code:
private sub commandbutton1_click()
me.hide
dim txt(1 to 8) as double
txt(1) = textbox1.text
txt(2) = textbox2.text
txt(3) = textbox3.text
txt(4) = textbox4.text
txt(5) = textbox5.text
txt(6) = textbox6.text
txt(7) = textbox7.text
txt(8) = textbox8.text
dim i as integer
dim j as integer
dim contatore as variant
contatore = 1
for j = 1 to 8
for i = j to 8
if txt(j) <> txt(i) then
contatore = contatore + 1
else
contatore = contatore
end if
next i
next j
msgbox contatore, vbokonly, "contatore"
me.show
end sub
I hope someone can help me or even just advise me on a road