-
Jul 26th, 2024, 12:33 AM
#1
Thread Starter
Junior Member
[RESOLVED] How to rank textbox value with name to another textbox?
in this image
Textbox1, textbox1_value1, textbox1_value2
Textbox2, textbox2_value1, textbox2_value2
Textbox3, textbox3_value1, textbox3_value2
Textbox4, textbox4_value1, textbox4_value2
Textbox5, textbox5_value1, textbox5_value2
if I click on the button the value will be added to the second panel textboxes according to the highest to lowest value of the Textbox#_Value1 but if the Textbox#_value1 = textbox#_Value(any two value id equal) then it will rank according to the lower value of textbox#_value2 of this equal value.
is it possible? any Idea? please help me. Thank you.
-
Jul 26th, 2024, 03:42 AM
#2
Re: How to rank textbox value with name to another textbox?
You have another thread that is obviously similar to this and that one is Resolved yet I see no effort at all on your part to solve this current problem. It seems like you just want someone else to do your work for you. How about you use what you've already learned to determine the logic involved and then make some effort to implement that logic, then ask a us a question when you encounter an actual issue?
-
Jul 26th, 2024, 03:48 AM
#3
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
Actually I am new and I have tried this for the last 7/8 days but failed. Sorry for the question. But really I am struggling with this. Thank you.
-
Jul 26th, 2024, 05:06 AM
#4
Re: How to rank textbox value with name to another textbox?
then show us what you have so far and explain where you are struggling, that way we can offer help and advice.
-
Jul 26th, 2024, 05:23 AM
#5
Re: How to rank textbox value with name to another textbox?
It's fine to struggle but don't just toss everything you've done and ask us to do it all for you. Explain your logic, show us your best attempt and tell us what actually happened and how that differed from your expectations. The best way to learn is to do so you do, we tell you what's wrong and then you do better. Even if it takes you a few iterations of back and forth to get there, that's fine. You'll learn more from that than just copy/pasting code that you don't really understand.
-
Jul 26th, 2024, 05:32 AM
#6
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
Code:
Dim inputTextBoxes() As TextBox = {T1Player1scoreRuns, T1Player2scoreRuns, T1Player3scoreRuns, T1Player4scoreRuns, T1Player5scoreRuns, T1Player6scoreRuns,
T1Player7scoreRuns, T1Player8scoreRuns, T1Player9scoreRuns, T1Player10scoreRuns, T1Player11scoreRuns}
Dim values(10) As Integer
For x As Integer = 0 To 10
Dim v As Integer
Integer.TryParse(inputTextBoxes(x).Text, v)
values(x) = v
Next
Array.Sort(values)
Array.Reverse(values)
Dim outputTextBoxes() As TextBox = {MA1Batsman1Run, MA1Batsman2Run, MA1Batsman3Run, MA1Batsman4Run}
For x As Integer = 0 To 3
outputTextBoxes(x).Text = values(x).ToString
Next
'Match Summary 1
If MA1Batsman1Run.Text = T1Player1scoreRuns.Text Then
MA1Batsman1.Text = T1Player1score.Text
MA1Batsman1Run.Text = T1Player1scoreRuns.Text
MA1Batsman1Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player2scoreRuns.Text Then
MA1Batsman1.Text = T1Player2score.Text
MA1Batsman1Run.Text = T1Player2scoreRuns.Text
MA1Batsman1Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player3scoreRuns.Text Then
MA1Batsman1.Text = T1Player3score.Text
MA1Batsman1Run.Text = T1Player3scoreRuns.Text
MA1Batsman1Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player4scoreRuns.Text Then
MA1Batsman1.Text = T1Player4score.Text
MA1Batsman1Run.Text = T1Player4scoreRuns.Text
MA1Batsman1Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player5scoreRuns.Text Then
MA1Batsman1.Text = T1Player5score.Text
MA1Batsman1Run.Text = T1Player5scoreRuns.Text
MA1Batsman1Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player6scoreRuns.Text Then
MA1Batsman1.Text = T1Player6score.Text
MA1Batsman1Run.Text = T1Player6scoreRuns.Text
MA1Batsman1Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player7scoreRuns.Text Then
MA1Batsman1.Text = T1Player7score.Text
MA1Batsman1Run.Text = T1Player7scoreRuns.Text
MA1Batsman1Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player8scoreRuns.Text Then
MA1Batsman1.Text = T1Player8score.Text
MA1Batsman1Run.Text = T1Player8scoreRuns.Text
MA1Batsman1Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player9scoreRuns.Text Then
MA1Batsman1.Text = T1Player9score.Text
MA1Batsman1Run.Text = T1Player9scoreRuns.Text
MA1Batsman1Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player10scoreRuns.Text Then
MA1Batsman1.Text = T1Player10score.Text
MA1Batsman1Run.Text = T1Player10scoreRuns.Text
MA1Batsman1Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player11scoreRuns.Text Then
MA1Batsman1.Text = T1Player11score.Text
MA1Batsman1Run.Text = T1Player11scoreRuns.Text
MA1Batsman1Balls.Text = T1Player11scoreBalls.Text
End If
'Match Summary 2
If MA1Batsman2Run.Text = T1Player1scoreRuns.Text And MA1Batsman1.Text <> T1Player1scoreRuns.Text Then
MA1Batsman2.Text = T1Player1score.Text
MA1Batsman2Run.Text = T1Player1scoreRuns.Text
MA1Batsman2Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player2scoreRuns.Text And MA1Batsman1.Text <> T1Player2scoreRuns.Text Then
MA1Batsman2.Text = T1Player2score.Text
MA1Batsman2Run.Text = T1Player2scoreRuns.Text
MA1Batsman2Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player3scoreRuns.Text And MA1Batsman1.Text <> T1Player3scoreRuns.Text Then
MA1Batsman2.Text = T1Player3score.Text
MA1Batsman2Run.Text = T1Player3scoreRuns.Text
MA1Batsman2Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player4scoreRuns.Text And MA1Batsman1.Text <> T1Player4scoreRuns.Text Then
MA1Batsman2.Text = T1Player4score.Text
MA1Batsman2Run.Text = T1Player4scoreRuns.Text
MA1Batsman2Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player5scoreRuns.Text And MA1Batsman1.Text <> T1Player5scoreRuns.Text Then
MA1Batsman2.Text = T1Player5score.Text
MA1Batsman2Run.Text = T1Player5scoreRuns.Text
MA1Batsman2Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player6scoreRuns.Text And MA1Batsman1.Text <> T1Player6scoreRuns.Text Then
MA1Batsman2.Text = T1Player6score.Text
MA1Batsman2Run.Text = T1Player6scoreRuns.Text
MA1Batsman2Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player7scoreRuns.Text And MA1Batsman1.Text <> T1Player7scoreRuns.Text Then
MA1Batsman2.Text = T1Player7score.Text
MA1Batsman2Run.Text = T1Player7scoreRuns.Text
MA1Batsman2Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player8scoreRuns.Text And MA1Batsman1.Text <> T1Player8scoreRuns.Text Then
MA1Batsman2.Text = T1Player8score.Text
MA1Batsman2Run.Text = T1Player8scoreRuns.Text
MA1Batsman2Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player9scoreRuns.Text And MA1Batsman1.Text <> T1Player9scoreRuns.Text Then
MA1Batsman2.Text = T1Player9score.Text
MA1Batsman2Run.Text = T1Player9scoreRuns.Text
MA1Batsman2Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player10scoreRuns.text And MA1Batsman1.Text <> T1Player10scoreRuns.Text Then
MA1Batsman2.Text = T1Player10score.Text
MA1Batsman2Run.Text = T1Player10scoreRuns.Text
MA1Batsman2Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player11scoreRuns.Text And MA1Batsman1.Text <> T1Player11scoreRuns.Text Then
MA1Batsman2.Text = T1Player11score.Text
MA1Batsman2Run.Text = T1Player11scoreRuns.Text
MA1Batsman2Balls.Text = T1Player11scoreBalls.Text
End If
'Match Summary 3
If MA1Batsman3Run.Text = T1Player1scoreRuns.Text Then
MA1Batsman3.Text = T1Player1score.Text
MA1Batsman3Run.Text = T1Player1scoreRuns.Text
MA1Batsman3Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player2scoreRuns.Text Then
MA1Batsman3.Text = T1Player2score.Text
MA1Batsman3Run.Text = T1Player2scoreRuns.Text
MA1Batsman3Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player3scoreRuns.Text Then
MA1Batsman3.Text = T1Player3score.Text
MA1Batsman3Run.Text = T1Player3scoreRuns.Text
MA1Batsman3Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player4scoreRuns.Text Then
MA1Batsman3.Text = T1Player4score.Text
MA1Batsman3Run.Text = T1Player4scoreRuns.Text
MA1Batsman3Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player5scoreRuns.Text Then
MA1Batsman3.Text = T1Player5score.Text
MA1Batsman3Run.Text = T1Player5scoreRuns.Text
MA1Batsman3Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player6scoreRuns.Text Then
MA1Batsman3.Text = T1Player6score.Text
MA1Batsman3Run.Text = T1Player6scoreRuns.Text
MA1Batsman3Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player7scoreRuns.Text Then
MA1Batsman3.Text = T1Player7score.Text
MA1Batsman3Run.Text = T1Player7scoreRuns.Text
MA1Batsman3Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player8scoreRuns.Text Then
MA1Batsman3.Text = T1Player8score.Text
MA1Batsman3Run.Text = T1Player8scoreRuns.Text
MA1Batsman3Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player9scoreRuns.Text Then
MA1Batsman3.Text = T1Player9score.Text
MA1Batsman3Run.Text = T1Player9scoreRuns.Text
MA1Batsman3Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player10scoreRuns.Text Then
MA1Batsman3.Text = T1Player10score.Text
MA1Batsman3Run.Text = T1Player10scoreRuns.Text
MA1Batsman3Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player11scoreRuns.Text Then
MA1Batsman3.Text = T1Player11score.Text
MA1Batsman3Run.Text = T1Player11scoreRuns.Text
MA1Batsman3Balls.Text = T1Player11scoreBalls.Text
End If
'Match Summary 4
If MA1Batsman4Run.Text = T1Player1scoreRuns.Text Then
MA1Batsman4.Text = T1Player1score.Text
MA1Batsman4Run.Text = T1Player1scoreRuns.Text
MA1Batsman4Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player2scoreRuns.Text Then
MA1Batsman4.Text = T1Player2score.Text
MA1Batsman4Run.Text = T1Player2scoreRuns.Text
MA1Batsman4Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player3scoreRuns.Text Then
MA1Batsman4.Text = T1Player3score.Text
MA1Batsman4Run.Text = T1Player3scoreRuns.Text
MA1Batsman4Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player4scoreRuns.Text Then
MA1Batsman4.Text = T1Player4score.Text
MA1Batsman4Run.Text = T1Player4scoreRuns.Text
MA1Batsman4Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player5scoreRuns.Text Then
MA1Batsman4.Text = T1Player5score.Text
MA1Batsman4Run.Text = T1Player5scoreRuns.Text
MA1Batsman4Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player6scoreRuns.Text Then
MA1Batsman4.Text = T1Player6score.Text
MA1Batsman4Run.Text = T1Player6scoreRuns.Text
MA1Batsman4Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player7scoreRuns.Text Then
MA1Batsman4.Text = T1Player7score.Text
MA1Batsman4Run.Text = T1Player7scoreRuns.Text
MA1Batsman4Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player8scoreRuns.Text Then
MA1Batsman4.Text = T1Player8score.Text
MA1Batsman4Run.Text = T1Player8scoreRuns.Text
MA1Batsman4Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player9scoreRuns.Text Then
MA1Batsman4.Text = T1Player9score.Text
MA1Batsman4Run.Text = T1Player9scoreRuns.Text
MA1Batsman4Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player10scoreRuns.Text Then
MA1Batsman4.Text = T1Player10score.Text
MA1Batsman4Run.Text = T1Player10scoreRuns.Text
MA1Batsman4Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player11scoreRuns.Text Then
MA1Batsman4.Text = T1Player11score.Text
MA1Batsman4Run.Text = T1Player11scoreRuns.Text
MA1Batsman4Balls.Text = T1Player11scoreBalls.Text
End If
-
Jul 26th, 2024, 05:33 AM
#7
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
here is the code. I have tried. but i am not finding ny better solution. I am sorry again for my help post. Thank you.
-
Jul 26th, 2024, 05:34 AM
#8
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
Originally Posted by PlausiblyDamp
then show us what you have so far and explain where you are struggling, that way we can offer help and advice.
Code:
Dim inputTextBoxes() As TextBox = {T1Player1scoreRuns, T1Player2scoreRuns, T1Player3scoreRuns, T1Player4scoreRuns, T1Player5scoreRuns, T1Player6scoreRuns,
T1Player7scoreRuns, T1Player8scoreRuns, T1Player9scoreRuns, T1Player10scoreRuns, T1Player11scoreRuns}
Dim values(10) As Integer
For x As Integer = 0 To 10
Dim v As Integer
Integer.TryParse(inputTextBoxes(x).Text, v)
values(x) = v
Next
Array.Sort(values)
Array.Reverse(values)
Dim outputTextBoxes() As TextBox = {MA1Batsman1Run, MA1Batsman2Run, MA1Batsman3Run, MA1Batsman4Run}
For x As Integer = 0 To 3
outputTextBoxes(x).Text = values(x).ToString
Next
'Match Summary 1
If MA1Batsman1Run.Text = T1Player1scoreRuns.Text Then
MA1Batsman1.Text = T1Player1score.Text
MA1Batsman1Run.Text = T1Player1scoreRuns.Text
MA1Batsman1Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player2scoreRuns.Text Then
MA1Batsman1.Text = T1Player2score.Text
MA1Batsman1Run.Text = T1Player2scoreRuns.Text
MA1Batsman1Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player3scoreRuns.Text Then
MA1Batsman1.Text = T1Player3score.Text
MA1Batsman1Run.Text = T1Player3scoreRuns.Text
MA1Batsman1Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player4scoreRuns.Text Then
MA1Batsman1.Text = T1Player4score.Text
MA1Batsman1Run.Text = T1Player4scoreRuns.Text
MA1Batsman1Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player5scoreRuns.Text Then
MA1Batsman1.Text = T1Player5score.Text
MA1Batsman1Run.Text = T1Player5scoreRuns.Text
MA1Batsman1Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player6scoreRuns.Text Then
MA1Batsman1.Text = T1Player6score.Text
MA1Batsman1Run.Text = T1Player6scoreRuns.Text
MA1Batsman1Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player7scoreRuns.Text Then
MA1Batsman1.Text = T1Player7score.Text
MA1Batsman1Run.Text = T1Player7scoreRuns.Text
MA1Batsman1Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player8scoreRuns.Text Then
MA1Batsman1.Text = T1Player8score.Text
MA1Batsman1Run.Text = T1Player8scoreRuns.Text
MA1Batsman1Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player9scoreRuns.Text Then
MA1Batsman1.Text = T1Player9score.Text
MA1Batsman1Run.Text = T1Player9scoreRuns.Text
MA1Batsman1Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player10scoreRuns.Text Then
MA1Batsman1.Text = T1Player10score.Text
MA1Batsman1Run.Text = T1Player10scoreRuns.Text
MA1Batsman1Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman1Run.Text = T1Player11scoreRuns.Text Then
MA1Batsman1.Text = T1Player11score.Text
MA1Batsman1Run.Text = T1Player11scoreRuns.Text
MA1Batsman1Balls.Text = T1Player11scoreBalls.Text
End If
'Match Summary 2
If MA1Batsman2Run.Text = T1Player1scoreRuns.Text And MA1Batsman1.Text <> T1Player1scoreRuns.Text Then
MA1Batsman2.Text = T1Player1score.Text
MA1Batsman2Run.Text = T1Player1scoreRuns.Text
MA1Batsman2Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player2scoreRuns.Text And MA1Batsman1.Text <> T1Player2scoreRuns.Text Then
MA1Batsman2.Text = T1Player2score.Text
MA1Batsman2Run.Text = T1Player2scoreRuns.Text
MA1Batsman2Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player3scoreRuns.Text And MA1Batsman1.Text <> T1Player3scoreRuns.Text Then
MA1Batsman2.Text = T1Player3score.Text
MA1Batsman2Run.Text = T1Player3scoreRuns.Text
MA1Batsman2Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player4scoreRuns.Text And MA1Batsman1.Text <> T1Player4scoreRuns.Text Then
MA1Batsman2.Text = T1Player4score.Text
MA1Batsman2Run.Text = T1Player4scoreRuns.Text
MA1Batsman2Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player5scoreRuns.Text And MA1Batsman1.Text <> T1Player5scoreRuns.Text Then
MA1Batsman2.Text = T1Player5score.Text
MA1Batsman2Run.Text = T1Player5scoreRuns.Text
MA1Batsman2Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player6scoreRuns.Text And MA1Batsman1.Text <> T1Player6scoreRuns.Text Then
MA1Batsman2.Text = T1Player6score.Text
MA1Batsman2Run.Text = T1Player6scoreRuns.Text
MA1Batsman2Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player7scoreRuns.Text And MA1Batsman1.Text <> T1Player7scoreRuns.Text Then
MA1Batsman2.Text = T1Player7score.Text
MA1Batsman2Run.Text = T1Player7scoreRuns.Text
MA1Batsman2Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player8scoreRuns.Text And MA1Batsman1.Text <> T1Player8scoreRuns.Text Then
MA1Batsman2.Text = T1Player8score.Text
MA1Batsman2Run.Text = T1Player8scoreRuns.Text
MA1Batsman2Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player9scoreRuns.Text And MA1Batsman1.Text <> T1Player9scoreRuns.Text Then
MA1Batsman2.Text = T1Player9score.Text
MA1Batsman2Run.Text = T1Player9scoreRuns.Text
MA1Batsman2Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player10scoreRuns.text And MA1Batsman1.Text <> T1Player10scoreRuns.Text Then
MA1Batsman2.Text = T1Player10score.Text
MA1Batsman2Run.Text = T1Player10scoreRuns.Text
MA1Batsman2Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman2Run.Text = T1Player11scoreRuns.Text And MA1Batsman1.Text <> T1Player11scoreRuns.Text Then
MA1Batsman2.Text = T1Player11score.Text
MA1Batsman2Run.Text = T1Player11scoreRuns.Text
MA1Batsman2Balls.Text = T1Player11scoreBalls.Text
End If
'Match Summary 3
If MA1Batsman3Run.Text = T1Player1scoreRuns.Text Then
MA1Batsman3.Text = T1Player1score.Text
MA1Batsman3Run.Text = T1Player1scoreRuns.Text
MA1Batsman3Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player2scoreRuns.Text Then
MA1Batsman3.Text = T1Player2score.Text
MA1Batsman3Run.Text = T1Player2scoreRuns.Text
MA1Batsman3Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player3scoreRuns.Text Then
MA1Batsman3.Text = T1Player3score.Text
MA1Batsman3Run.Text = T1Player3scoreRuns.Text
MA1Batsman3Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player4scoreRuns.Text Then
MA1Batsman3.Text = T1Player4score.Text
MA1Batsman3Run.Text = T1Player4scoreRuns.Text
MA1Batsman3Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player5scoreRuns.Text Then
MA1Batsman3.Text = T1Player5score.Text
MA1Batsman3Run.Text = T1Player5scoreRuns.Text
MA1Batsman3Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player6scoreRuns.Text Then
MA1Batsman3.Text = T1Player6score.Text
MA1Batsman3Run.Text = T1Player6scoreRuns.Text
MA1Batsman3Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player7scoreRuns.Text Then
MA1Batsman3.Text = T1Player7score.Text
MA1Batsman3Run.Text = T1Player7scoreRuns.Text
MA1Batsman3Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player8scoreRuns.Text Then
MA1Batsman3.Text = T1Player8score.Text
MA1Batsman3Run.Text = T1Player8scoreRuns.Text
MA1Batsman3Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player9scoreRuns.Text Then
MA1Batsman3.Text = T1Player9score.Text
MA1Batsman3Run.Text = T1Player9scoreRuns.Text
MA1Batsman3Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player10scoreRuns.Text Then
MA1Batsman3.Text = T1Player10score.Text
MA1Batsman3Run.Text = T1Player10scoreRuns.Text
MA1Batsman3Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman3Run.Text = T1Player11scoreRuns.Text Then
MA1Batsman3.Text = T1Player11score.Text
MA1Batsman3Run.Text = T1Player11scoreRuns.Text
MA1Batsman3Balls.Text = T1Player11scoreBalls.Text
End If
'Match Summary 4
If MA1Batsman4Run.Text = T1Player1scoreRuns.Text Then
MA1Batsman4.Text = T1Player1score.Text
MA1Batsman4Run.Text = T1Player1scoreRuns.Text
MA1Batsman4Balls.Text = T1Player1scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player2scoreRuns.Text Then
MA1Batsman4.Text = T1Player2score.Text
MA1Batsman4Run.Text = T1Player2scoreRuns.Text
MA1Batsman4Balls.Text = T1Player2scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player3scoreRuns.Text Then
MA1Batsman4.Text = T1Player3score.Text
MA1Batsman4Run.Text = T1Player3scoreRuns.Text
MA1Batsman4Balls.Text = T1Player3scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player4scoreRuns.Text Then
MA1Batsman4.Text = T1Player4score.Text
MA1Batsman4Run.Text = T1Player4scoreRuns.Text
MA1Batsman4Balls.Text = T1Player4scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player5scoreRuns.Text Then
MA1Batsman4.Text = T1Player5score.Text
MA1Batsman4Run.Text = T1Player5scoreRuns.Text
MA1Batsman4Balls.Text = T1Player5scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player6scoreRuns.Text Then
MA1Batsman4.Text = T1Player6score.Text
MA1Batsman4Run.Text = T1Player6scoreRuns.Text
MA1Batsman4Balls.Text = T1Player6scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player7scoreRuns.Text Then
MA1Batsman4.Text = T1Player7score.Text
MA1Batsman4Run.Text = T1Player7scoreRuns.Text
MA1Batsman4Balls.Text = T1Player7scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player8scoreRuns.Text Then
MA1Batsman4.Text = T1Player8score.Text
MA1Batsman4Run.Text = T1Player8scoreRuns.Text
MA1Batsman4Balls.Text = T1Player8scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player9scoreRuns.Text Then
MA1Batsman4.Text = T1Player9score.Text
MA1Batsman4Run.Text = T1Player9scoreRuns.Text
MA1Batsman4Balls.Text = T1Player9scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player10scoreRuns.Text Then
MA1Batsman4.Text = T1Player10score.Text
MA1Batsman4Run.Text = T1Player10scoreRuns.Text
MA1Batsman4Balls.Text = T1Player10scoreBalls.Text
ElseIf MA1Batsman4Run.Text = T1Player11scoreRuns.Text Then
MA1Batsman4.Text = T1Player11score.Text
MA1Batsman4Run.Text = T1Player11scoreRuns.Text
MA1Batsman4Balls.Text = T1Player11scoreBalls.Text
End If
-
Jul 26th, 2024, 05:38 AM
#9
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
T1Player1score.Text = 1st table name
T1Player1scoreRuns.Text = 1st table vlaue1
T1Player1scoreBalls.Text = 1st table value 2
MA1Batsman1.Text = 2nd table name
MA1Batsman1Run.Text =2nd table value1
MA1Batsman1Balls.Text = 2nd table value2
-
Jul 26th, 2024, 05:59 AM
#10
Re: How to rank textbox value with name to another textbox?
One of my main concerns when helping people is that they show effort. I said:
Explain your logic, show us your best attempt and tell us what actually happened and how that differed from your expectations.
but all you've done is dump a load of code. Did the code compile? If not, where are the errors and what were the error messages? If the code runs, have you actually debugged it? If not then you shouldn't even be asking a question yet because you ALWAYS need to debug first. You should then be able to tell us, as I said, exactly where and how the code doesn't behave as you expect. You need to provide a FULL and CLEAR explanation of the problem. If you can't do that then you haven't spent enough time considering it.
Also, you really shouldn't ever get to the point of having that much code to dump. You should be working out the logic involved and breaking it up into smaller parts, then tackling one part at a time. If the first part doesn't work then you can ask us about that specifically, without all the noise. If you do get some parts to work but get stuck on a later step, you know that the problem is not in whatever went before. There's a lot more to writing code than just writing code. "Divide and conquer" is problem-solving 101 in any field.
-
Jul 26th, 2024, 06:25 AM
#11
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
It runs and shows name 1 to the other box where the value2 is equal.
-
Jul 26th, 2024, 09:50 AM
#12
Re: How to rank textbox value with name to another textbox?
While you're determination to provide as little explanation as possible is admirable, it's not going to get you too far. I said this:
You should then be able to tell us, as I said, exactly where and how the code doesn't behave as you expect. You need to provide a FULL and CLEAR explanation of the problem.
Ignore it at your peril. We shouldn't have to drag every bit of information out of you or guess or make assumptions. Many people just won't bother making the effort if you're not prepared to.
-
Jul 26th, 2024, 10:12 AM
#13
Re: How to rank textbox value with name to another textbox?
Originally Posted by Rakibswn
It runs and shows name 1 to the other box where the value2 is equal.
Have you tried debugging your code? i.e. Using breakpoints and stepping through it to see if it behaves as you would expect?
Do you have expectations for what your code should be doing? If you don't understand the logic, then that is what is needed first - coding isn't the same as problem solving; you need to work out the logical steps to get to the solution you want, and then implement the code. If you understand what is needed, and what is going wrong, then we can offer help and advice.
-
Jul 26th, 2024, 10:17 AM
#14
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
-
Jul 26th, 2024, 11:22 AM
#15
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
But I am really struggling with this. Could not find any better logic.
-
Jul 26th, 2024, 04:48 PM
#16
Re: How to rank textbox value with name to another textbox?
You haven't explained your logic, or tried to tell us how the results differ from what you expect.
-
Jul 26th, 2024, 05:27 PM
#17
Re: How to rank textbox value with name to another textbox?
I’m struggling to understand what your program is supposed to be doing. Try to explain in terms of real world objects instead of cryptic control names. Use images to illustrate the outcome and maybe the steps you’d take to get that outcome…
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 26th, 2024, 10:06 PM
#18
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
Attachment 192379
I am struggling with transferring the name and value2 according to the score. In the image its just ranks the Value 1 but does not show the name and value 2 on the other two columns. I have tried to use if else but failed.
this code is transferring the and ranking the value1 but name and value1 are not transferring. (screeenshots)
Code:
Dim inputTextBoxes() As TextBox = {Player5Run, Player1Run, Player2Run, Player4Run, Player3Run}
Dim values(4) As Integer
For x As Integer = 0 To 4
Dim v As Integer
Integer.TryParse(inputTextBoxes(x).Text, v)
values(x) = v
Next
Array.Sort(values)
Array.Reverse(values)
Dim outputTextBoxes() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
For x As Integer = 0 To 4
outputTextBoxes(x).Text = values(x).ToString
Next
Last edited by Rakibswn; Jul 26th, 2024 at 10:09 PM.
-
Jul 26th, 2024, 10:48 PM
#19
Re: How to rank textbox value with name to another textbox?
Ok. This will probably be close to what you're hoping for...
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'@@@ These are your 5 name textboxes
Dim yourColumn1TextBoxes() As TextBox = {TextBoxName1, TextBoxName2, TextBoxName3, TextBoxName4, TextBoxName5}
'@@@ These are your 5 value1 textboxes
Dim inputTextBoxes() As TextBox = {Player5Run, Player1Run, Player2Run, Player4Run, Player3Run}
'@@@ This stores the 2 original column's contents
Dim secondaryArray(4) As String
'@@@ This is the array used for sorting
Dim values(4) As Integer
For x As Integer = 0 To 4
Dim v As Integer
Integer.TryParse(inputTextBoxes(x).Text, v)
'@@@ v is the integer value from the textbox
values(x) = v
'@@@ These are the 2 original column's contents, stored as a single string per item
secondaryArray(x) = yourColumn1TextBoxes(x).Text & "," & inputTextBoxes(x).Text
Next
'@@@ This sorts both the values array and the secondaryArray array
'@@@ The values array is the key, meaning both arrays are sorted according to the integers contained
Array.Sort(values, secondaryArray)
'@@@ This reverses the arrays, so they're sorted DESC
Array.Reverse(values)
Array.Reverse(secondaryArray)
'@@@ These are the textboxes to contain the sorted values
Dim outputTextBoxes() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
For x As Integer = 0 To 4
'@@@ Outputs the sorted values
outputTextBoxes(x).Text = values(x).ToString
Dim fields() As String = secondaryArray(x).Split(","c)
'@@@ Outputs the other 2 sortd columns
yourColumn1TextBoxes(x).Text = fields(0)
inputTextBoxes(x).Text = fields(1)
Next
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 26th, 2024, 10:54 PM
#20
Re: How to rank textbox value with name to another textbox?
If i'm wrong about you wanting to output back to the left side sets of 3 textboxes, let me know
BTW, your image hasn't loaded in post #18
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 26th, 2024, 11:05 PM
#21
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
Originally Posted by .paul.
Ok. This will probably be close to what you're hoping for...
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'@@@ These are your 5 name textboxes
Dim yourColumn1TextBoxes() As TextBox = {TextBoxName1, TextBoxName2, TextBoxName3, TextBoxName4, TextBoxName5}
'@@@ These are your 5 value1 textboxes
Dim inputTextBoxes() As TextBox = {Player5Run, Player1Run, Player2Run, Player4Run, Player3Run}
'@@@ This stores the 2 original column's contents
Dim secondaryArray(4) As String
'@@@ This is the array used for sorting
Dim values(4) As Integer
For x As Integer = 0 To 4
Dim v As Integer
Integer.TryParse(inputTextBoxes(x).Text, v)
'@@@ v is the integer value from the textbox
values(x) = v
'@@@ These are the 2 original column's contents, stored as a single string per item
secondaryArray(x) = yourColumn1TextBoxes(x).Text & "," & inputTextBoxes(x).Text
Next
'@@@ This sorts both the values array and the secondaryArray array
'@@@ The values array is the key, meaning both arrays are sorted according to the integers contained
Array.Sort(values, secondaryArray)
'@@@ This reverses the arrays, so they're sorted DESC
Array.Reverse(values)
Array.Reverse(secondaryArray)
'@@@ These are the textboxes to contain the sorted values
Dim outputTextBoxes() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
For x As Integer = 0 To 4
'@@@ Outputs the sorted values
outputTextBoxes(x).Text = values(x).ToString
Dim fields() As String = secondaryArray(x).Split(","c)
'@@@ Outputs the other 2 sortd columns
yourColumn1TextBoxes(x).Text = fields(0)
inputTextBoxes(x).Text = fields(1)
Next
End Sub
this code is sorting in the same table. Thank you so much. Thank you thank you.
-
Jul 26th, 2024, 11:06 PM
#22
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
-
Jul 26th, 2024, 11:14 PM
#23
Re: How to rank textbox value with name to another textbox?
Ok. What are the names of the textboxes in the second table?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 26th, 2024, 11:21 PM
#24
Re: How to rank textbox value with name to another textbox?
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'@@@ These are your 5 name textboxes
Dim yourColumn1TextBoxes() As TextBox = {TextBoxName1, TextBoxName2, TextBoxName3, TextBoxName4, TextBoxName5}
'@@@ These are your 5 value1 textboxes
Dim inputTextBoxes() As TextBox = {Player5Run, Player1Run, Player2Run, Player4Run, Player3Run}
'@@@ This stores the 2 original column's contents
Dim secondaryArray(4) As String
'@@@ This is the array used for sorting
Dim values(4) As Integer
For x As Integer = 0 To 4
Dim v As Integer
Integer.TryParse(inputTextBoxes(x).Text, v)
'@@@ v is the integer value from the textbox
values(x) = v
'@@@ These are the 2 original column's contents, stored as a single string per item
secondaryArray(x) = yourColumn1TextBoxes(x).Text & "," & inputTextBoxes(x).Text
Next
'@@@ This sorts both the values array and the secondaryArray array
'@@@ The values array is the key, meaning both arrays are sorted according to the integers contained
Array.Sort(values, secondaryArray)
'@@@ This reverses the arrays, so they're sorted DESC
Array.Reverse(values)
Array.Reverse(secondaryArray)
'@@@ These are the textboxes to contain the sorted values
Dim outputTextBoxes() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
Dim yourOutputColumn1TextBoxes() As TextBox = {[put textbox names],,,,}
Dim yourOutputColumn2TextBoxes() As TextBox = {[put textbox names],,,,}
For x As Integer = 0 To 4
'@@@ Outputs the sorted values
outputTextBoxes(x).Text = values(x).ToString
Dim fields() As String = secondaryArray(x).Split(","c)
'@@@ Outputs the other 2 sortd columns
yourOutputColumn1TextBoxes(x).Text = fields(0)
yourOutputColumn2TextBoxes(x).Text = fields(1)
Next
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 26th, 2024, 11:21 PM
#25
Thread Starter
Junior Member
Re: How to rank textbox value with name to another textbox?
Originally Posted by .paul.
Ok. What are the names of the textboxes in the second table?
I have changes the output name and its working fine. THank you so much. I am struggling with this for almost 7/8 days.It was very hard for me. Thank you. thank you.
-
Jul 26th, 2024, 11:22 PM
#26
Re: [RESOLVED] How to rank textbox value with name to another textbox?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 26th, 2024, 11:23 PM
#27
Thread Starter
Junior Member
Re: [RESOLVED] How to rank textbox value with name to another textbox?
Here is the final code.
Code:
'@@@ These are your 5 name textboxes
Dim yourColumn1TextBoxes() As TextBox = {Player1, Player2, Player3, Player4, Player5}
'@@@ These are your 5 value1 textboxes
Dim inputTextBoxes() As TextBox = {Player1Run, Player2Run, Player3Run, Player4Run, Player5Run}
Dim inputTextBoxes2() As TextBox = {Ball1, Ball2, Ball3, Ball4, Ball5}
'@@@ This stores the 2 original column's contents
Dim secondaryArray(4) As String
'@@@ This is the array used for sorting
Dim values(4) As Integer
For x As Integer = 0 To 4
Dim v As Integer
Integer.TryParse(inputTextBoxes(x).Text, v)
'@@@ v is the integer value from the textbox
values(x) = v
'@@@ These are the 2 original column's contents, stored as a single string per item
secondaryArray(x) = yourColumn1TextBoxes(x).Text & "," & inputTextBoxes(x).Text & "," & inputTextBoxes2(x).Text
Next
'@@@ This sorts both the values array and the secondaryArray array
'@@@ The values array is the key, meaning both arrays are sorted according to the integers contained
Array.Sort(values, secondaryArray)
'@@@ This reverses the arrays, so they're sorted DESC
Array.Reverse(values)
Array.Reverse(secondaryArray)
'@@@ These are the textboxes to contain the sorted values
Dim outputTextBoxes() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
For x As Integer = 0 To 4
'@@@ Outputs the sorted values
outputTextBoxes(x).Text = values(x).ToString
Dim fields() As String = secondaryArray(x).Split(","c)
'@@@ Outputs the other 2 sortd columns
Dim MA1() As TextBox = {Player6, Player7, Player8, Player9, Player10}
Dim MA2() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
Dim MA3() As TextBox = {Ball6, Ball7, Ball8, Ball9, Ball10}
MA1(x).Text = fields(0)
MA2(x).Text = fields(1)
MA3(x).Text = fields(2)
Next
-
Jul 26th, 2024, 11:34 PM
#28
Re: [RESOLVED] How to rank textbox value with name to another textbox?
Declaring some of those arrays in the For, Next loop is wrong. Move these lines...
Code:
'@@@ Outputs the other 2 sortd columns
Dim MA1() As TextBox = {Player6, Player7, Player8, Player9, Player10}
Dim MA2() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
Dim MA3() As TextBox = {Ball6, Ball7, Ball8, Ball9, Ball10}
To...
Code:
Dim outputTextBoxes() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
MOVE TO HERE
For x As Integer = 0 To 4
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 27th, 2024, 08:34 AM
#29
Thread Starter
Junior Member
Re: [RESOLVED] How to rank textbox value with name to another textbox?
-
Jul 27th, 2024, 12:17 PM
#30
Thread Starter
Junior Member
Re: [RESOLVED] How to rank textbox value with name to another textbox?
Originally Posted by .paul.
Declaring some of those arrays in the For, Next loop is wrong. Move these lines...
Code:
'@@@ Outputs the other 2 sortd columns
Dim MA1() As TextBox = {Player6, Player7, Player8, Player9, Player10}
Dim MA2() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
Dim MA3() As TextBox = {Ball6, Ball7, Ball8, Ball9, Ball10}
To...
Code:
Dim outputTextBoxes() As TextBox = {Player6Run, Player7Run, Player8Run, Player9Run, Player10Run}
MOVE TO HERE
For x As Integer = 0 To 4
sorry for interrupt you again. Its sorting all null values also. How can I ignore null values?
-
Jul 27th, 2024, 12:31 PM
#31
Re: [RESOLVED] How to rank textbox value with name to another textbox?
Where is it putting the null values? You can’t completely ignore them. It’ll put them in as 0. You can ignore 0…
Code:
outputTextBoxes(x).Text = if(values(x) > 0, values(x).ToString, “”)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 28th, 2024, 08:28 AM
#32
Thread Starter
Junior Member
Re: [RESOLVED] How to rank textbox value with name to another textbox?
Originally Posted by .paul.
Where is it putting the null values? You can’t completely ignore them. It’ll put them in as 0. You can ignore 0…
Code:
outputTextBoxes(x).Text = if(values(x) > 0, values(x).ToString, “”)
Attachment 192386
thank you for your code. I am trying to sort this by using your code outputTextBoxes(x).Text = If(values(x) > 0, values(x).ToString, “”). But If I try to rank by making everything 0 but last one is null or every value is equal then it is counting the null value at first. but I want to ignore the null values. I want to start from >0. I am trying since tomorrow .but failed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|