Convert Case To Random In Vb6

Thread Solved

Join Date: Mar 2009
Posts: 7
Reputation: clarkpoon is an unknown quantity at this point 
Solved Threads: 0
clarkpoon clarkpoon is offline Offline
Newbie Poster

Convert Case To Random In Vb6

 
0
  #1
Mar 14th, 2009
Convert Case To Random In Vb6

I've only 1 Textbox & 1 Button... can anyone help my?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 1,094
Reputation: cguan_77 has a little shameless behaviour in the past 
Solved Threads: 91
cguan_77's Avatar
cguan_77 cguan_77 is offline Offline
Veteran Poster

Re: Convert Case To Random In Vb6

 
0
  #2
Mar 14th, 2009
Originally Posted by clarkpoon View Post
Convert Case To Random In Vb6

I've only 1 Textbox & 1 Button... can anyone help my?

Thanks
you like to convert a string but the position of the character to be converted will be controlled randomly or what?
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 7
Reputation: clarkpoon is an unknown quantity at this point 
Solved Threads: 0
clarkpoon clarkpoon is offline Offline
Newbie Poster

Re: Convert Case To Random In Vb6

 
0
  #3
Mar 15th, 2009
^^

when i'll click the Button text in TEXTBOX shows Letters like...

ABCD to aBCd

every characters CASE Will change to RAnDom case...
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 7
Reputation: clarkpoon is an unknown quantity at this point 
Solved Threads: 0
clarkpoon clarkpoon is offline Offline
Newbie Poster

Re: Convert Case To Random In Vb6

 
0
  #4
Mar 15th, 2009
help me, guys
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 798
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 145
vb5prgrmr vb5prgrmr is offline Offline
Master Poster

Re: Convert Case To Random In Vb6

 
0
  #5
Mar 15th, 2009
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4. Text1.Text = "This is a test. This is only a test."
  5. End Sub
  6.  
  7. Private Sub Command1_Click()
  8. Randomize
  9. Dim ForLoopCounter As Integer, TextLength As Integer, TempInt As Integer
  10. TextLength = Len(Text1.Text)
  11. For ForLoopCounter = 1 To TextLength
  12. If Mid(Text1.Text, ForLoopCounter, 1) <> " " Then
  13. TempInt = (Rnd * 1) + 1
  14. If TempInt > 1 Then
  15. ChangeCase ForLoopCounter, True, TextLength
  16. Else
  17. ChangeCase ForLoopCounter, False, TextLength
  18. End If
  19. End If
  20. Next ForLoopCounter
  21. End Sub
  22.  
  23. Private Sub ChangeCase(Position As Integer, UpperCase As Boolean, StringLength As Integer)
  24. If Position = 1 Then
  25. If UpperCase = True Then
  26. Text1.Text = UCase(Left(Text1.Text, 1)) & Mid(Text1.Text, 2)
  27. Else
  28. Text1.Text = LCase(Left(Text1.Text, 1)) & Mid(Text1.Text, 2)
  29. End If
  30. ElseIf Position = StringLength Then
  31. If UpperCase = True Then
  32. Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1) & UCase(Right(Text1.Text, 1))
  33. Else
  34. Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1) & LCase(Right(Text1.Text, 1))
  35. End If
  36. Else
  37. If UpperCase = True Then
  38. Text1.Text = Left(Text1.Text, (Position - 1)) & UCase(Mid(Text1.Text, Position, 1)) & Mid(Text1.Text, (Position + 1))
  39. Else
  40. Text1.Text = Left(Text1.Text, (Position - 1)) & LCase(Mid(Text1.Text, Position, 1)) & Mid(Text1.Text, (Position + 1))
  41. End If
  42. End If
  43. End Sub
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 7
Reputation: clarkpoon is an unknown quantity at this point 
Solved Threads: 0
clarkpoon clarkpoon is offline Offline
Newbie Poster

Re: Convert Case To Random In Vb6

 
0
  #6
Mar 16th, 2009
thx vb5prgrmr
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC