Click here to Skip to main content
15,890,557 members
Home / Discussions / C#
   

C#

 
Questionwhen application needs to access the db all the time Pin
prasadbuddhika23-Aug-07 2:04
prasadbuddhika23-Aug-07 2:04 
AnswerRe: when application needs to access the db all the time Pin
Vasudevan Deepak Kumar23-Aug-07 2:25
Vasudevan Deepak Kumar23-Aug-07 2:25 
GeneralRe: when application needs to access the db all the time Pin
PIEBALDconsult23-Aug-07 5:58
mvePIEBALDconsult23-Aug-07 5:58 
AnswerRe: when application needs to access the db all the time Pin
\laddie24-Aug-07 1:05
\laddie24-Aug-07 1:05 
QuestionSpreed Sheet Data!! Pin
kibromg23-Aug-07 1:45
kibromg23-Aug-07 1:45 
AnswerRe: Spreed Sheet Data!! Pin
Vasudevan Deepak Kumar23-Aug-07 2:26
Vasudevan Deepak Kumar23-Aug-07 2:26 
GeneralRe: Spreed Sheet Data!! Pin
kibromg23-Aug-07 3:22
kibromg23-Aug-07 3:22 
QuestionControl the entered value Pin
Kamrul Ahsan23-Aug-07 1:32
Kamrul Ahsan23-Aug-07 1:32 
Hi
could you please see the could below.
/* Product.cs*/

using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace Product
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private bool logicalControl()
{
if (txtproductcode.Text == "")
{
MessageBox.Show(this, "Please enter the product code",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
if (txtproductamount.Text == "")
{
MessageBox.Show(this, "Please enter the stock amount",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
if (txtproductprice.Text == "")
{
MessageBox.Show(this, "Please enter the unit price",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
if (grupBox.Text == "")
{
MessageBox.Show(this, "Please enter the group",
this.Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}

return true;
}

private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void Insertproduct(string pCode, string pName, string pAmount, string pPrice, string pGrup)
{
OleDbCommand cmd = new OleDbCommand("INSERT INTO [Product_List](ProductCode, Brand, Stock, Price, Group) VALUES(@Code, @Brand, @Stock, @Price, @Grup)", Connection.GetConnection());
cmd.Parameters.AddWithValue("@Code", pCode);
cmd.Parameters.AddWithValue("@Brand", pName);
cmd.Parameters.AddWithValue("@Stock", pAmount);
cmd.Parameters.AddWithValue("@Price", pPrice);
cmd.Parameters.AddWithValue("@Grup", pGrup);
cmd.Connection.Close();
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}

private void btnAdd_Click(object sender, EventArgs e)
{
if (logicalControl() == false)
return;
Insertproduct(txtproductcode.Text, cmbBrand.Text, txtproductamount.Text, txtproductprice.Text, grupBox.Text);
txtproductcode.Text = "";
cmbBrand.Text = "";
txtproductamount.Text = "";
txtproductprice.Text = "";
grupBox.Text = "";
MessageBox.Show("Product Details Saved", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);


}
}
}

In this form I have three text box which will take the values only integer.they are
txtproductamount.Text = "";
txtproductprice
grupBox
txtproductamount
I want to control if user enter anything exept Integer it will show error. because they are saved in my database as integer.
please help me if possible.
Thank you

Kamrul Ahsan
Istanbul,Turkey

AnswerRe: Control the entered value Pin
Giorgi Dalakishvili23-Aug-07 1:39
mentorGiorgi Dalakishvili23-Aug-07 1:39 
GeneralRe: Control the entered value Pin
Kamrul Ahsan23-Aug-07 1:57
Kamrul Ahsan23-Aug-07 1:57 
AnswerRe: Control the entered value Pin
Christian Graus23-Aug-07 1:48
protectorChristian Graus23-Aug-07 1:48 
AnswerRe: Control the entered value Pin
prasadbuddhika23-Aug-07 1:50
prasadbuddhika23-Aug-07 1:50 
Questionremote computer admin [modified] Pin
sourabhsorate23-Aug-07 0:26
sourabhsorate23-Aug-07 0:26 
AnswerRe: remote computer admin Pin
Christian Graus23-Aug-07 1:01
protectorChristian Graus23-Aug-07 1:01 
GeneralRe: remote computer admin Pin
sourabhsorate16-Sep-07 23:01
sourabhsorate16-Sep-07 23:01 
QuestionReading temperature values Pin
Tim Wuytens23-Aug-07 0:10
Tim Wuytens23-Aug-07 0:10 
AnswerRe: Reading temperature values Pin
Giorgi Dalakishvili23-Aug-07 0:19
mentorGiorgi Dalakishvili23-Aug-07 0:19 
GeneralRe: Reading temperature values Pin
Tim Wuytens23-Aug-07 0:32
Tim Wuytens23-Aug-07 0:32 
GeneralRe: Reading temperature values Pin
Giorgi Dalakishvili23-Aug-07 0:51
mentorGiorgi Dalakishvili23-Aug-07 0:51 
AnswerRe: Reading temperature values Pin
Hessam Jalali23-Aug-07 1:37
Hessam Jalali23-Aug-07 1:37 
GeneralRe: Reading temperature values Pin
Dan Neely23-Aug-07 2:16
Dan Neely23-Aug-07 2:16 
GeneralRe: Reading temperature values Pin
Hessam Jalali23-Aug-07 2:25
Hessam Jalali23-Aug-07 2:25 
QuestionProblem when reading DBF files Pin
vuthaianh22-Aug-07 23:52
vuthaianh22-Aug-07 23:52 
QuestionHow can move a UserControl in the form? Pin
leminhphuong22-Aug-07 23:10
leminhphuong22-Aug-07 23:10 
AnswerRe: How can move a UserControl in the form? Pin
Martin#22-Aug-07 23:14
Martin#22-Aug-07 23:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.