943,733 Members | Top Members by Rank

Ad:
Mar 14th, 2009
0

Convert Case To Random In Vb6

Expand Post »
Convert Case To Random In Vb6

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

Thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
clarkpoon is offline Offline
7 posts
since Mar 2009
Mar 14th, 2009
0

Re: Convert Case To Random In Vb6

Click to Expand / Collapse  Quote originally posted by clarkpoon ...
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?
Reputation Points: 19
Solved Threads: 115
Nearly a Posting Virtuoso
cguan_77 is offline Offline
1,317 posts
since Apr 2007
Mar 15th, 2009
0

Re: Convert Case To Random In Vb6

^^

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

ABCD to aBCd

every characters CASE Will change to RAnDom case...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
clarkpoon is offline Offline
7 posts
since Mar 2009
Mar 15th, 2009
0

Re: Convert Case To Random In Vb6

help me, guys
Reputation Points: 10
Solved Threads: 0
Newbie Poster
clarkpoon is offline Offline
7 posts
since Mar 2009
Mar 15th, 2009
0

Re: Convert Case To Random In Vb6

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
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Mar 16th, 2009
0

Re: Convert Case To Random In Vb6

thx vb5prgrmr
Reputation Points: 10
Solved Threads: 0
Newbie Poster
clarkpoon is offline Offline
7 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Need Help to insert data to MS Access table
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how my computer will be open





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC