Capt MonkeyBoy
Member
- Joined
- Jan 26, 2005
- Messages
- 5
- Programming Experience
- Beginner
hi
i am learning VB.net with out any other knowledge of programming, it's going ok but i'm stuck on a basic text encoding problem where i have to change all ASC code by -1,,,, i like to try and work everything out my self and bimble my way,, but i just can work this out at the mo,, i have worked out how to encode 1 letter,
> change every thing in a text box to upper or lower case with out having to click a button
> and with having to click a button
> can also pick out a letter and encode it
but i just can't work out how to change all the Asc(##) -1, i know it's going to be simple, but i just can't seem to find my way to it....
thanks for any help
[/color][/color]
i am learning VB.net with out any other knowledge of programming, it's going ok but i'm stuck on a basic text encoding problem where i have to change all ASC code by -1,,,, i like to try and work everything out my self and bimble my way,, but i just can work this out at the mo,, i have worked out how to encode 1 letter,
VB.NET:
[color=#0000ff]Private[/color][color=#0000ff]Sub[/color] Enc_Click([color=#0000ff]ByVal[/color] sender [color=#0000ff]As[/color] System.Object, [color=#0000ff]ByVal[/color] e [color=#0000ff]As[/color] System.EventArgs) [color=#0000ff]Handles[/color] btnEnc.Click
[color=#0000ff]Dim[/color] MyInt [color=#0000ff]As[/color][color=#0000ff]Integer
[/color][color=#0000ff]Dim[/color] MyChar [color=#0000ff]As[/color][color=#0000ff]Char
[/color]MyInt = Asc(txt1.Text) - 1
MyChar = Chr(MyInt)
txt1.Text = Format(MyChar, "")
[color=blue]E[/color][color=#0000ff]nd[/color][color=#0000ff]Sub[/color]
> change every thing in a text box to upper or lower case with out having to click a button
VB.NET:
[color=#0000ff][color=#000000][/color][/color]
[color=#0000ff][color=#0000ff]Private[/color][color=#0000ff]Sub[/color][color=#000000] Form1_Load([/color][color=#0000ff]ByVal[/color][color=#000000] sender [/color][color=#0000ff]As[/color][color=#000000] System.Object, [/color][color=#0000ff]ByVal[/color][color=#000000] e [/color][color=#0000ff]As[/color][color=#000000] System.EventArgs) [/color][color=#0000ff]Handles[/color][color=#0000ff]MyBase[/color][color=#000000].Load[/color]
txt1.CharacterCasing = CharacterCasing.Upper
[color=#0000ff]End[/color][color=#0000ff]Sub[/color]
> and with having to click a button
VB.NET:
[/color]
[color=#000000][color=#0000ff]PrivateSub[/color] Enc_Click([color=#0000ff]ByVal[/color] sender [color=#0000ff]As[/color] System.Object, [color=#0000ff]ByVal[/color] e [color=#0000ff]As[/color] System.EventArgs) [color=#0000ff]Handles[/color] btnEnc.Click[/color]
[color=#0000ff][color=#000000][/color][/color]
[color=#0000ff][color=#000000][color=#0000ff]Dim[/color] MyStr1 [color=#0000ff]As[/color][color=#0000ff]String
[/color]MyStr1 = UCase(rtb1.Text)
rtb2.Text = Format(MyStr1, "")
[color=blue]End[/color][color=#0000ff]Sub[/color]
VB.NET:
[color=#0000ff]PrivateSub[/color] Enc_Click([color=#0000ff]ByVal[/color] sender [color=#0000ff]As[/color] System.Object, [color=#0000ff]ByVal[/color] e [color=#0000ff]As[/color] System.EventArgs) [color=#0000ff]Handles[/color] btnEnc.Click
[color=#0000ff]Dim[/color] StrLength [color=#0000ff]As[/color][color=#0000ff]Integer
[/color][color=#0000ff]Dim[/color] MyStr [color=#0000ff]As[/color][color=#0000ff]String
[/color][color=#0000ff]Dim[/color] MyInt [color=#0000ff]As[/color][color=#0000ff]Integer
[/color]StrLength = Len(rtb1.Text) - 3
MyStr = Mid(rtb1.Text, Len(rtb1.Text) - StrLength + 1, 1)
MyInt = Asc(MyStr) - 1
rtb2.Text = Format(MyInt, "")
[color=blue]End[/color][color=#0000ff]Sub[/color]
but i just can't work out how to change all the Asc(##) -1, i know it's going to be simple, but i just can't seem to find my way to it....
thanks for any help
[/color][/color]
Last edited: