Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttadd.Click
If Me.txtage.Text = "" Or Me.txtheight.Text = "" Or Me.txtweight.Text = "" Or Me.txtabdomen.Text = "" Or Me.txtbp.Text = "" Or Me.txtpr.Text = "" Or Me.txtrr.Text = "" Or Me.txttemp.Text = "" Or txtextrimities.Text = "" Or txtheart.Text = "" Or Me.txtlung.Text Or txtskin.Text = "" Or Me.txtmdiag.Text = "" Or Me.txtremarks.Text = "" Then
MessageBox.Show("All fields mus not be blank!")
Exit Sub
Else
cls.addcheck(txtage.Text, txtheight.Text, txtweight.Text, txtabdomen.Text, txtbp.Text, txtpr.Text, txtrr.Text, txtextrimities.Text, txtheart.Text, txtlung.Text, txtskin.Text, txtmdiag.Text, txtremarks.Text)
End If
End Sub
38 Replies - 684 Views - Last Post: 03 March 2012 - 10:10 PM
#1
adding in database error
Posted 03 March 2012 - 12:59 AM
Replies To: adding in database error
#2
Re: adding in database error
Posted 03 March 2012 - 01:17 AM
This post has been edited by nK0de: 03 March 2012 - 01:22 AM
#3
Re: adding in database error
Posted 03 March 2012 - 01:32 AM
#4
Re: adding in database error
Posted 03 March 2012 - 01:44 AM
#5
Re: adding in database error
Posted 03 March 2012 - 01:53 AM
So are you sure you're entering values to every Textbox there?
#6
Re: adding in database error
Posted 03 March 2012 - 02:16 AM
#7
Re: adding in database error
Posted 03 March 2012 - 02:23 AM
btw I noticed this later. Your error message All fields mus not be blank!
first tell me, do you want to display this message,
1. when at least one Textbox is empty? or
2. when all the Textboxes are empty?
Which one do you want to happen?
This post has been edited by nK0de: 03 March 2012 - 02:24 AM
#8
Re: adding in database error
Posted 03 March 2012 - 02:37 AM
nK0de, on 03 March 2012 - 02:23 AM, said:
btw I noticed this later. Your error message All fields mus not be blank!
first tell me, do you want to display this message,
1. when at least one Textbox is empty? or
2. when all the Textboxes are empty?
Which one do you want to happen?
i want at least one is blank then the message would show up sir
#10
Re: adding in database error
Posted 03 March 2012 - 02:50 AM
nK0de, on 03 March 2012 - 02:48 AM, said:
but im 100% sure im entering all of it not even a single textbox that is left blank
#11
Re: adding in database error
Posted 03 March 2012 - 03:04 AM
If String.IsNullOrWhiteSpace(TextBox1.Text)
MessageBox.Show("Empty textbox")
Else
MessageBox.Show("Okay")
End If
Try this way and let me know.
#12
Re: adding in database error
Posted 03 March 2012 - 03:30 AM
nK0de, on 03 March 2012 - 03:04 AM, said:
If String.IsNullOrWhiteSpace(TextBox1.Text)
MessageBox.Show("Empty textbox")
Else
MessageBox.Show("Okay")
End If
Try this way and let me know.
sir i tried it but it has a message that looks like this:
Error 1 'isnotnullorwhitespace' is not a member of 'String'. C:\Users\Christopher\Documents\Visual Studio 2008\Projects\Clinic System\WindowsApplication2\frmcheckup.vb 7 12 WindowsApplication2
here is my code oh and i made some changes and put a comment on my last codes here it is:
Public Class frmcheckup
Dim cls As New Class1
Dim con As New OleDb.OleDbConnection
Dim sql As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttadd.Click
If String.isnotnullorwhitespace(Me.txtage.Text) Then
MessageBox.Show("Empty textbox")
Else
MessageBox.Show("ok")
End If
'If Me.txtage.Text = "" Or Me.txtheight.Text = "" Or Me.txtweight.Text = "" Or Me.txtabdomen.Text = "" Or Me.txtbp.Text = "" Or Me.txtpr.Text = "" Or Me.txtrr.Text = "" Or Me.txttemp.Text = "" Or txtextrimities.Text = "" Or txtheart.Text = "" Or Me.txtlung.Text Or txtskin.Text = "" Or Me.txtmdiag.Text = "" Or Me.txtremarks.Text = "" Then
' MessageBox.Show("All fields mus not be blank!")
' Else
'cls.addcheck(txtage.Text, txtheight.Text, txtweight.Text, txtabdomen.Text, txtbp.Text, txtpr.Text, txtrr.Text, txttemp.Text, txtextrimities.Text, txtheart.Text, txtlung.Text, txtskin.Text, txtmdiag.Text, txtremarks.Text)
'Dim cmd As New OleDb.OleDbCommand
' cmd.CommandText = sql
' cmd.Connection = con
' cmd.ExecuteNonQuery()
' cmd.Dispose()
' MessageBox.Show("Record added")
' End If
End Sub
#13
Re: adding in database error
Posted 03 March 2012 - 03:34 AM
what's the .NET framework you're using? I'm assuming its not 4. That's why that error occurs.
This post has been edited by nK0de: 03 March 2012 - 03:45 AM
#14
Re: adding in database error
Posted 03 March 2012 - 03:40 AM
nK0de, on 03 March 2012 - 03:34 AM, said:
what's the .NET framework you're using? I'm assuming its not 4. That's why that error occurs.
If you are okay with it, you can attach your project here so that I can take a look at it.
im using 2008 express edition for vb.net and sql management studio express for my database sir
#15
Re: adding in database error
Posted 03 March 2012 - 03:44 AM
|
|

New Topic/Question
Reply



MultiQuote




|