Starfleeter
Member
- Joined
- Oct 31, 2010
- Messages
- 5
- Programming Experience
- Beginner
Alright, I can't figure out for the life of me to how to do this but this is what I'm trying to do. I want Val(InitialStrength.Text) to be set as the variable iST so I'm typing this at the top of the page before all my subs:
but every time I do that and try to compile without even using the variabe, I get this error:
"An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."
I apologize if the solution is something minor but I'm just starting with VB.net and trying to learn it on my own and I've noticed it's difficult to use help files, etc to find basic help.
VB.NET:
Public Class CharacterSheet
Public iST As Integer = Val(InitialStrength.Text)
Private Sub InitialStrength_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InitialStrength.TextChanged
Dim a As Integer = Val(InitialStrength.Text)
Dim c As Integer = Val(InitialStrength.Text) + Val(InitialPerception.Text) + Val(InitialEndurance.Text) + Val(InitialCharisma.Text) + Val(InitialIntelligence.Text) + Val(InitialAgility.Text) + Val(InitialLuck.Text)
Dim b As Integer = 40
If a > 10 Then
InitialStrength.Text = 10
ElseIf (a < 1) Then
InitialStrength.Text = 1
Else
InitialStrength.Text = Val(InitialStrength.Text)
End If
If (b - c) >= 0 Then
lblSPECIALTotal.Text = (b - c)
End If
If chkStrengthImplant.Checked = True Then
FinalStrength.Text = Val(InitialStrength.Text) + 1
Else
FinalStrength.Text = Val(InitialStrength.Text)
End If
If Val(FinalStrength.Text) > 10 Then
FinalStrength.Text = 10
End If
End Sub
but every time I do that and try to compile without even using the variabe, I get this error:
"An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."
I apologize if the solution is something minor but I'm just starting with VB.net and trying to learn it on my own and I've noticed it's difficult to use help files, etc to find basic help.
Last edited: