Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

VB.NET Programming Corner!

Dapat ang field mo is character, hindi pwede ang integer dyan, kasi ignore nya lang ang
trailing zeros...,
 
sir patulong po ule... meron na akong code na naididisplay ang sequence number galing sa database na nag a-auto increment na... nag-umpisa aq sa number 0001 then mag iincrement na xia ng 1.... kaso pagdinisplay ko na xa sa textlabel ang nagpapakita lang ay 2(two)... eh gusto ko sana ang display ay ganito 0002... pano po ba un?? eto code q


Dim cn As New MySqlConnection(CnPath)
Dim Sql As String = "Select max(sequence) From tblsequence"
Dim Cmd As New MySqlCommand(Sql, cn)

cn.Open()

Dim datinfo As MySqlDataReader = Cmd.ExecuteReader()
While datinfo.Read()
If IsDBNull(datinfo(0)) = True Then
seq.Text = (Val(Description.Text)) + Val(1)
Else
labelsequence.Text = datinfo(0) + 1
End If

End While
cn.Close()



Example:

Dim num As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
num = num + 1
Label1.Text = Format(num, "0000")
End Sub
 
patulong po ule... ayaw gumana sa combobox ung try catch na numeric lang ang iiinput... Sa textbox gumagana... eto po code q...

Dim num As Integer
Try
num = System.Convert.ToDouble(ComboBox1.Text())

Catch ex As Exception
If ComboBox1.Text() = "" Then

Else
MessageBox.Show("Error: Please enter a number", "Error in Input", MessageBoxButtons.OK, MessageBoxIcon.Error)
ComboBox1.Text = ""
ComboBox1.Focus()
End If
End Try
 
patulong po ule... ayaw gumana sa combobox ung try catch na numeric lang ang iiinput... Sa textbox gumagana... eto po code q...

Dim num As Integer
Try
num = System.Convert.ToDouble(ComboBox1.Text())

Catch ex As Exception
If ComboBox1.Text() = "" Then

Else
MessageBox.Show("Error: Please enter a number", "Error in Input", MessageBoxButtons.OK, MessageBoxIcon.Error)
ComboBox1.Text = ""
ComboBox1.Focus()
End If
End Try


walang parenthesis ang text property

combobox1.text lang

para mapadali ka use cdbl(combobox1.text) instead of system.convert

besides that meron function na isnumeric use it like this

Code:
if isnumeric(combobox1.text) = false
   MessageBox.Show("Error: Please enter a number", "Error in Input", MessageBoxButtons.OK, MessageBoxIcon.Error)
                ComboBox1.Text = ""
                ComboBox1.Focus()
end if

that way di mo na kaylangan mag convert sa double di mo na rin kaylangan ng try catch
 
mga kuya sino po sa inyo may ebook ng homeandlearn..
Wala po kasi ako makita sa google.. :slap:

Thanks po..
 
mga ka symb pa help naman... nagseself study lang po ako ng vb.net... question lang, bakita ayaw mag trigger ng code na to?

Code:
If LenTrimTrue(txtUser.Text) = True Then
            msgFillField("Username")
            Exit Sub
        ElseIf LenTrimTrue(txtPass.Text) = True Then
            msgFillField("Password")
            Exit Sub
        End If

        Dim conn As New SqlConnection(gConString)
        conn.Open()
        Dim comm As New SqlCommand()
        comm.CommandText = "SELECT * FROM USERS WHERE USERN = '" & txtUser.Text & "' AND PASSW = '" & txtPass.Text & "'"
        comm.Connection = conn
        Dim readerLogin As SqlDataReader
        readerLogin = comm.ExecuteReader

        While readerLogin.Read
            If readerLogin.Item("UserN") = txtUser.Text And readerLogin.Item("PassW") = txtPass.Text Then
                Me.Hide()
                mdiForm1.Show()
                gAcctName = readerLogin.Item("AcctName")
                msgLoginSuc()
            [B]Else
                MessageBox.Show("Invalid Account", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)[/B]
            End If
        End While

        readerLogin.Close()
        conn.Close()
    End Sub

basically simple login palang yan. lahat naman ng nasa code gumagana pero ung nakabold na messagebox hindi... ano kaya prob?
 
Last edited:
@TS

d ko alm kung na tanong na kc d nkapost.

Sana kung meron lng pakishare nmn po VB installer mo.

Kung Direct sana Mediafire Links bagay mo.
 
Download ka nalang muna sa microsoft..
Kaso ang problem d ko alam kung pano kumuha ng serial ng vb2008 dun....
vb2010 ang nakuhanan ko ng serial...
 
mga ka symb pa help naman... nagseself study lang po ako ng vb.net... question lang, bakita ayaw mag trigger ng code na to?

Code:
If LenTrimTrue(txtUser.Text) = True Then
            msgFillField("Username")
            Exit Sub
        ElseIf LenTrimTrue(txtPass.Text) = True Then
            msgFillField("Password")
            Exit Sub
        End If

        Dim conn As New SqlConnection(gConString)
        conn.Open()
        Dim comm As New SqlCommand()
        comm.CommandText = "SELECT * FROM USERS WHERE USERN = '" & txtUser.Text & "' AND PASSW = '" & txtPass.Text & "'"
        comm.Connection = conn
        Dim readerLogin As SqlDataReader
        readerLogin = comm.ExecuteReader

        While readerLogin.Read
            If readerLogin.Item("UserN") = txtUser.Text And readerLogin.Item("PassW") = txtPass.Text Then
                Me.Hide()
                mdiForm1.Show()
                gAcctName = readerLogin.Item("AcctName")
                msgLoginSuc()
            [B]Else
                MessageBox.Show("Invalid Account", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)[/B]
            End If
        End While

        readerLogin.Close()
        conn.Close()
    End Sub

basically simple login palang yan. lahat naman ng nasa code gumagana pero ung nakabold na messagebox hindi... ano kaya prob?


Try dis:

MsgBox("Invalid Account", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Error")
 
cge ung 2010 nlng hehe pero yaw ko sa MS kc bagal ang downloading dun.
 
Meron akong Visual Studio 2008 and Visual Studio 2010 Ultimate..
Kaya lang wala akong premium account sa file hosting eh.. di ko maupload..:slap:
 
problem buh un?

Chapchapin mo nlng poh xa.

Part1
Part2
 
mga kuya baka meron kayong source code dyan or apllication para sa internal office chat na merong conference and private message at kung pwede meron din attach files or memo.
 
Last edited:
[QUOTE=ang vb.net ba ai un ang bagong gnagamit now sa pag gawa ng program puro visual basic 6.0 lng kc gnagamit nmin sa skul eh. newbie lng po kc ako sa pag gawa ng program this caming may pa ako gagraduit :)tanong lng po sir my alam ka poba kayokng pano gumawa ng application sa uzzap like autoflood :)give nman po example kng pano gumawa non:yipee:
 
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim enNum As Integer
        Dim sNum As Integer
        Dim Answer As Integer

        sNum = startNum.Text
        enNum = EndNum.Text

        For sNum = sNum To enNum


            Answer = Answer + sNum

        Next

        MsgBox(Answer)


    End Sub

Gusto ko po sana gawin na mag karon ng MessageBox kapag
Walang laman ung 1st and/or 2nd textbox...

D ko po kasi magawa sa end if
Lagi sya mag bug... :help:

Padagdag nalang po ng Code...

Eto ung exercise na gusto ko sagutan..
Sinubukan ko na ung mga pedeng code pero bug parin..
Kaya nahingi na ko ng tulong... :help:

Exercise

Amend your code to check that the user has entered numbers in the textboxes. You will need an If statement to do this. If there's nothing in the textboxes, you can halt the programme with this code

Exit Sub

For this exercise, you will be passing whatever is in the textboxes to integer variables. It is these variables you are checking with your If Statement. Because numbers will be entered into the textboxes, remember to convert the text to a value with Val( ).

But the Text property will return a zero if the box is empty. So your If statement will need to check the variables for a value of zero. If it finds a zero, Then you can use the Exit Sub code. The If statement should come first, before the For Loop code.
 
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim enNum As Integer
        Dim sNum As Integer
        Dim Answer As Integer

        sNum = startNum.Text
        enNum = EndNum.Text

        For sNum = sNum To enNum


            Answer = Answer + sNum

        Next

        MsgBox(Answer)


    End Sub

Gusto ko po sana gawin na mag karon ng MessageBox kapag
Walang laman ung 1st and/or 2nd textbox...

D ko po kasi magawa sa end if
Lagi sya mag bug... :help:

Padagdag nalang po ng Code...

Eto ung exercise na gusto ko sagutan..
Sinubukan ko na ung mga pedeng code pero bug parin..
Kaya nahingi na ko ng tulong... :help:



For this exercise, you will be passing whatever is in the textboxes to integer variables. It is these variables you are checking with your If Statement. Because numbers will be entered into the textboxes, remember to convert the text to a value with Val( ).

enclose mo daw sa val yung text box ganto


Code:
snum = val(startnum.text)

itry mo sa end num



But the Text property will return a zero if the box is empty So your If statement will need to check the variables for a value of zero.
If it finds a zero, Then you can use the Exit Sub code. .

ang sabi zero daw ang ireturn pag walang laman ang box.
zero din ang result nyan pag may letter so yan ang ilagay mo sa IF statement mo kung zero ang lumabas ilagay mo na yun message box tapos exit sub.


The If statement should come first, before the For Loop code.

ilagay mo daw yung if statement mo bago sa FOR LOOP

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim enNum As Integer
        Dim sNum As Integer
        Dim Answer As Integer

' dito mo ilagay ang if statement
'ang syntax ng if statement ganto

' if  <condtion is true> then
'  dito mo ilagay ang msgbox at exit sub
'  dapat mauna ang msgbox ha bago ang exit sub
'end if

        sNum = startNum.Text
        enNum = EndNum.Text

        For sNum = sNum To enNum


            Answer = Answer + sNum

        Next

        MsgBox(Answer)


    End Sub
 
Back
Top Bottom