brat Problema cod VB 2010
Results 1 to 2 of 2

Thread: Problema cod VB 2010

  1. #1
    Bă, ce te uiţi ? omgwtf's Avatar
    Join Date
    Feb 2006
    Location
    Montreal, Canada

    Problema cod VB 2010

    Public Class Form1

    'Declaring vars

    Private StudentID As Long
    Private FirstName As String
    Private LastName As String
    Private MExam As System.Double
    Private FExam As System.Double
    Private FProj As System.Double
    Private FResult As System.Double

    Private Function CheckIsNumber(ByRef value As String) As Boolean
    Dim result As Boolean = True
    Debug.Print(value)
    result = IsNumeric(value)
    If (result = False) Then
    MessageBox.Show("Please enter a valid number (from 1 to 7 digits only)", "Invalid Data")
    End If
    Return result

    End Function




    ''Get data


    Private Sub txtBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBox2.TextChanged

    FirstName = txtBox2.Text

    End Sub

    Private Sub txtBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtBox3.TextChanged

    LastName = Convert.ToString(txtBox3.Text)

    End Sub


    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

    lstStudent.Items.Add(txtBox1.Text & " " & txtBox2.Text & " " & txtBox3.Text & " " & txtBox4.Text & " " & txtBox5.Text & " " & txtBox6.Text & " " & txtBox7.Text)

    End Sub

    Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
    'lstStudent.Items.Remove()

    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click

    If MessageBox.Show("Do you really want to exit?", "Warning", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
    Application.Exit()
    End If

    End Sub




    'Clear labels



    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click

    txtBox1.Text = ""
    txtBox2.Text = ""
    txtBox3.Text = ""
    txtBox4.Text = ""
    txtBox5.Text = ""
    txtBox6.Text = ""
    txtBox7.Text = ""

    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


    End Sub



    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click


    If (txtBox1.Text).Length <> 7 Then

    MessageBox.Show("Please enter a 7 digit number")
    txtBox1.Text = ""
    txtBox1.Focus()
    Exit Sub

    End If

    If CheckIsNumber(txtBox1.Text) Then
    StudentID = Convert.ToInt64(txtBox1.Text)
    Else
    MessageBox.Show("Please enter a 7 digit number")

    End If
    StudentID = txtBox1.Text

    If (Not (IsNumeric(txtBox4.Text))) Then
    MessageBox.Show("Please enter a value between 0-100")
    Exit Sub
    Else
    MExam = Convert.ToDecimal(txtBox4.Text)
    End If

    If (MExam >= 0 And MExam <= 100) Then
    Else
    MessageBox.Show("Please enter a value between 0-100")

    Exit Sub
    End If

    If (CheckIsNumber(txtBox4.Text)) Then
    MExam = Convert.ToDouble(txtBox4.Text) * 0.3
    End If


    If (Not (IsNumeric(txtBox5.Text))) Then
    MessageBox.Show("Please enter a value between 0-100")
    Exit Sub
    Else
    MExam = Convert.ToDecimal(txtBox5.Text)
    End If

    If (FExam >= 0 And FExam <= 100) Then
    Else
    MessageBox.Show("Please enter a value between 0-100")
    Exit Sub
    End If

    If (CheckIsNumber(txtBox5.Text)) Then
    FExam = Convert.ToDouble(txtBox5.Text) * 0.3
    End If

    If (Not (IsNumeric(txtBox6.Text))) Then
    MessageBox.Show("Please enter a value between 0-100")
    Exit Sub
    Else
    MExam = Convert.ToDecimal(txtBox6.Text)
    End If

    If (FProj >= 0 And FProj <= 100) Then
    Else
    MessageBox.Show("Please enter a value between 0-100")
    Exit Sub
    End If

    If (CheckIsNumber(txtBox6.Text)) Then
    FProj = Convert.ToDouble(txtBox6.Text) * 0.4
    End If


    FResult = Convert.ToDouble(MExam) + Convert.ToDouble(FExam) + Convert.ToDouble(FProj)
    txtBox7.Text = FResult

    End Sub



    End Class

    MExam - 30%
    FExam - 30%
    Fproj - 40%

    Nu imi calculeaza bine cand afiseaza FResult, poate vedeti voi unde e greseseala ?

  2. #2
    Registered User cloud's Avatar
    Join Date
    Oct 2003
    Location
    Bucuresti
    s-ar putea sa-ti faca un cast aiurea, desi.... incearca txtBox7.Text = FResult.ToString() si vezi daca afiseaza corect.
    Useri neseriosi: Pharaoh_KiLLaH

  1.  
    Free Online Strategy Games - Last Post

Similar Threads

  1. [Vând] Vind MW2 + COD Black Ops si BC2 + MOH 2010
    By Raider290 in forum Jocuri şi Software PC / Mac
    Replies: 9
    Last Post: 22-03-2011, 11:23
  2. [Vând] Vand jocuri MOH 2010/ POP 2010/ SDR 2010.ps3
    By micutu13 in forum Console (Jocuri / Hardware / Accesorii)
    Replies: 21
    Last Post: 21-01-2011, 14:39
  3. problema cod validare
    By Needucat in forum ComputerGames Shop
    Replies: 0
    Last Post: 28-01-2009, 22:29

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •