i want to display pop window Or popup message on textbox or buttoncontrol?

Posted by Sudheep.grandhe under C# on 11/25/2011 | Points: 10 | Views : 2854 | Status : [Member] | Replies : 5
Hi,

I've a form in that some fields are there .if the user without entering those fields he tries to click submit or add button.in that case it has to show some popwindow or popup message.please do the needful.

Best,
Sudheep.



Responses

Posted by: Nitesh.luharuka on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down
Private Sub butApply_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles butApply.Click

If tbStateID.Text = Nothing Then
MsgBox("State I D is Required", MsgBoxStyle.Critical, "Error")
cbStateID.Select()
Return
End If
If tbSuburb.Text = "" Then
MsgBox("Suburb is Required", MsgBoxStyle.Critical, "Error")
tbSuburb.Select()
Return
End If
Process the rest....
End Sub


Nitesh Luharuka
http://www.niteshluharuka.com

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudheep.grandhe on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

thanks for replying me.i need in windows applications only.

Best,
Sudheep.

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nitesh.luharuka on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down
Sudeep,

That is a code for windows applications only. There is a button on form named butApply and its click handler is written in VB.Net. What language are you using?

Nitesh Luharuka
http://www.niteshluharuka.com

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudheep.grandhe on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,


i am using c#.net

Best,
Sudheep.

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nitesh.luharuka on: 11/26/2011 [Member] Starter | Points: 25

Up
0
Down
The code I wrote above is in VB.Net. Please find below in C#.

      private void button1_Click(object sender, EventArgs e)

{
if (textBox1.Text.Length == 0)
{
MessageBox.Show("Textbox1 should not be empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
if (textBox2.Text.Length == 0)
{
MessageBox.Show("Textbox3 should not be empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
if (textBox3.Text.Length == 0)
{
MessageBox.Show("Textbox3 should not be empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}


Nitesh Luharuka
http://www.niteshluharuka.com

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response