Reputed number problem switch case statement

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2008
Posts: 17
Reputation: ravindransrm is an unknown quantity at this point 
Solved Threads: 3
ravindransrm ravindransrm is offline Offline
Newbie Poster

Reputed number problem switch case statement

 
0
  #1
May 9th, 2009
Reputed number problem switch case statement

hai This is my code

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click



Dim i As String
i = TextBox1.Text
Dim x As Object
For Each x In i

Dim num As Integer
num = x.ToString()
Select Case num
Case 1
str1 = "R"
Case 2
str2 = "A"
Case 3
str3 = "V"
Case 4
str4 = "I"
Case 5
str5 = "N"
Case 6
str6 = "D"
Case 7
str7 = "R"
Case 8
str8 = "A"
Case 9
str9 = "N"
Case 0
str0 = "M"
case else
str11="O"

End Select


Next

Dim temp1, temp2 As String
temp1 = TextBox3.Text
temp2 = TextBox4.Text
TextBox2.Text = String.Concat(temp1, temp2, str1, str2, str3, str4, str5, str6, str7, str8, str9, str0,str11)


End Sub







i will enter 144 output RI it show me Last number leave it

my requirement is i will enter this kind of number check
last nearest number repeat at that time else case work
show string 'O' output like as RIO
send some idea about....

i need help from u all
by
srm.....
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 89
Reputation: toko is an unknown quantity at this point 
Solved Threads: 8
toko's Avatar
toko toko is offline Offline
Junior Poster in Training

Re: Reputed number problem switch case statement

 
0
  #2
May 9th, 2009
I think this is what you want:
  1. Public Class Form1
  2. Dim i As String
  3. Dim x As Object
  4. Dim phrase As String
  5. Dim num As Integer
  6. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  7. i = TextBox1.Text
  8. For Each x In i
  9. num = x.ToString()
  10. Select Case num
  11. Case 1
  12. phrase += "R"
  13. Case 2
  14. phrase += "A"
  15. Case 3
  16. phrase += "V"
  17. Case 4
  18. phrase += "I"
  19. Case 5
  20. phrase += "N"
  21. Case 6
  22. phrase += "D"
  23. Case 7
  24. phrase += "R"
  25. Case 8
  26. phrase += "A"
  27. Case 9
  28. phrase += "N"
  29. Case 0
  30. phrase += "M"
  31. Case Else
  32. phrase += "O"
  33. End Select
  34. Next
  35. TextBox2.Text = phrase
  36. End Sub
  37. End Class
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 17
Reputation: ravindransrm is an unknown quantity at this point 
Solved Threads: 3
ravindransrm ravindransrm is offline Offline
Newbie Poster

Re: Reputed number problem switch case statement

 
0
  #3
May 10th, 2009
To : Respected sir

Thank you very much sir for your quick and very useful reply. Finaly i have done my one problem.


This same solution if i will enter repeated number like as 222
first 2 i want display "A" if next strings come same 2's goto else part "o"

how i will to this some idea .......to me

Once again thank you
Last edited by ravindransrm; May 10th, 2009 at 5:47 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC