|
hai all,
is there any function for SetROP2 in c#.net. i want to use this SetROP2 function in C# which will take float values in draw mode
private static extern Int32 SetROP2(IntPtr hDevice, int nDrawMode)
|
|
|
|
|
hello every one!
well I got this query here, I'm really stuck in this error. I'm working oin a master detail form in .net 2.0 C# in Windows Forms. its a System.ArgumentException that I'm getting here. I've these dataGridview on the form. I've made a typed dataset for it. the tables are these
PurchBill(PurchBillID, VendID, Bookno, BillDate)
Purch(purchID,purchbillID,Serial, ModelID, PresentAt,PurchWarranty,PurchPrice)
ProdLine
ProdModel
and vu_manNames thats a view
I've set up seperate dataGridViews for Purch, ProdLine and ProdModel and for selecting the manufacturer name here. Look at this code
private void saverecord()
{
try
{
int n = 0;
if (flagUpdate == false)
{
for (int row = 0; row < dataGridViewPurch.Rows.Count; row++)
{
DataRow dr = dsPurch1.Purch.NewRow();
dr["PurchBillID"] = sqlInsertCommandPurch.Parameters["@purchBillID"].Value = dsPurch1.PurchBill[this.BindingContext[dsPurch1, "PurchBill"].Position].PurchBillID;
MessageBox.Show("Value of Serial \n" + dataGridViewPurch.Rows[row].Cells["Serial"].Value.ToString());
dr["Serial"] = sqlInsertCommandPurch.Parameters["@Serial"].Value = dataGridViewPurch.Rows[row].Cells["Serial"].Value.ToString();
dr["PurchPrice"] = sqlInsertCommandPurch.Parameters["@PurchPrice"].Value = Convert.ToDecimal(dataGridViewPurch.Rows[row].Cells["PurchPrice"].Value.ToString());
MessageBox.Show("Value of ModelID: " + dsPurch1.ProdModel[this.BindingContext[dsPurch1, "ProdModel"].Position].ModelID.ToString());
dr["PurchWarranty"] = sqlInsertCommandPurch.Parameters["@Purchwarranty"].Value = Convert.ToDecimal(dataGridViewPurch.Rows[row].Cells["PurchWarranty"].Value.ToString());
dr["modelID"] = sqlInsertCommandPurch.Parameters["@ModelID"].Value = dsPurch1.ProdModel[this.BindingContext[dsPurch1,"ProdModel"].Position].ModelID ;
dsPurch1.Purch.Rows.Add(dr);
//MessageBox.Show("Hello");
n += daPurch.Update(dsPurch1, dsPurch1.Purch.ToString());
//refreshDataSet();
}
MessageBox.Show("Number of records inserted: " + n.ToString());
dsPurch1.AcceptChanges();
}
else
{
//this code is for the updating a record.
for (int row = 0; row < dataGridViewPurch.Rows.Count; row++)
{
if (dataGridViewPurch.Rows[row].Cells["PurchPrice"].Value.ToString().Length != 0)
{
dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].BeginEdit();
sqlUpdateCommandPurch.Parameters["@PurchBillID"].Value = dsPurch1.PurchBill[this.BindingContext[dsPurch1, "PurchBill"].Position].PurchBillID = Convert.ToDecimal(dataGridViewPurch.Rows[row].Cells["PurchBillID"].Value.ToString());
//sqlUpdateCommandPurch.Parameters["@PurchBillID"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PurchBillID = Convert.ToDecimal(dataGridViewPurch.Rows[row].Cells["PurchBillID"].Value.ToString());
sqlUpdateCommandPurch.Parameters["@PresentAt"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PresentAt = 1;
sqlUpdateCommandPurch.Parameters["@ModelID"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].ModelID = Convert.ToDecimal(dataGridViewProdModel.SelectedRows[0].Cells["ModelID"].Value.ToString());
for (int col = 0; col < 3; col++)
{
if (col == 0)
sqlUpdateCommandPurch.Parameters["@PurchPrice"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PurchPrice = Convert.ToDecimal(dataGridViewPurch.Rows[row].Cells["PurchPrice"].Value.ToString());
else if (col == 1)
sqlUpdateCommandPurch.Parameters["@Serial"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].Serial = dataGridViewPurch.Rows[row].Cells["serial"].Value.ToString();
else
sqlUpdateCommandPurch.Parameters["@Purchwarranty"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PurchWarranty = Convert.ToDecimal(dataGridViewPurch.Rows[row].Cells["PurchWarranty"].Value.ToString());
sqlUpdateCommandPurch.Parameters["@Original_PurchID"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PurchID;
sqlUpdateCommandPurch.Parameters["@Original_purchBillID"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PurchBillID;
sqlUpdateCommandPurch.Parameters["@Original_purchPrice"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PurchPrice;
sqlUpdateCommandPurch.Parameters["@Original_Serial"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].Serial;
sqlUpdateCommandPurch.Parameters["@Original_PurchWarranty"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PurchWarranty;
sqlUpdateCommandPurch.Parameters["@Original_PresentAt"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].PresentAt;
sqlUpdateCommandPurch.Parameters["@Original_ModelID"].Value = dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].ModelID;
MessageBox.Show("Position\n" + this.BindingContext[dsPurch1, "Purch"].Position.ToString());
dsPurch1.Purch[this.BindingContext[dsPurch1, "Purch"].Position].EndEdit();
n += daPurch.Update(dsPurch1, "Purch");
dsPurch1.AcceptChanges();
MessageBox.Show("Number of records updated" + n.ToString());
}
}
else
{
MessageBox.Show("Invalid Serial no");
}
}
}
//btnNavFirst.Enabled = btnNavNext.Enabled = btnNavPrev.Enabled = btnLast.Enabled = true;
}
catch (DBConcurrencyException ex)
{
MessageBox.Show("Zero records affected.\n\n" + ex.ToString());
}
catch (SystemException ex)
{
MessageBox.Show("The source table could not be found.\n\n" + ex.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
=======================================================================
this is meant to save and update as necessary and I’m getting the error on the line I’ve made bold and it says that
System.ArgumentException: Column names Serial can not be found
Parameter name: columnName
At system.Windows.Forms.DataGridViewCellCollection.get_Item(String columnName)
I’ve set up the datamember property to u know the child of PurchBill that is the purch table. I think there are a few errors in the datagridView class (maybe).
Plz help me out of this, I think I’m getting crazy here
Thanks in advance
What I don’t understand is that I’ve done the same work for anoter form in the same fashion and its working fine. It seems to me that there is no property named with these columns here but why is this happenin? And what should I do abt it?
Rocky
|
|
|
|
|
I have written a User Control which has a button and a text box on it. The textbox is updated by using
UserControlTxtBox.Text= someValue;
This works fine if there is one User Control on a form.
If I have 2 or more, the first User Control works ok initially, but once I start to access the Text property of the TextBox on the second control, both Text properties on both controls get updated with the same information from then on. It seems to be updating the User Controls' textBox rather than the base control individually.
Any idea on how I can fix this?
Regards
alias47
|
|
|
|
|
Hello,
Are you creating the Usercontrols dynamicaly?
Do you have an instance variable for each usercontrol?
All the best,
Martin
|
|
|
|
|
hi,
i want to send/receive some commands to one hardware device through GPIB card(one end is connected to System(USB port) one end is connected to device) in c#.net .
i wnat to know in which way i can communicate the device and what r requried fields to access the hardware through GPIB card.
plz send sample code for that .
it's very usefull to in my application.
Thanks
prem
|
|
|
|
|
Hi,
I want start application from another application.
for example
if i have a,b,c,d applications.
so if i want to start a,b,c application through d application.
how to do ?
help me out.
thanks
|
|
|
|
|
Hello,
System.Diagnostics.Process.Start("filename");
All the best,
MArtin
|
|
|
|
|
thanks for help ,it's working for
but if application on remote location then?
|
|
|
|
|
Hello,
I'm not sure if I understand you right, but maybe you find youre processes with:
System.Diagnostics.Process.GetProcesses(machinename);
and then Start them over there instance.
All the best,
Martin
|
|
|
|
|
I am trying to develope a music server through which any music player can connect and play the songs and other medias,so if anyone has any idea about it ,do post me.
nishu
|
|
|
|
|
Hello Nishu,
I think this tool may helpfull to u.
Here is there audio library
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Thanks divyang!!!i will try and let you know aboout that
nishu
|
|
|
|
|
Do u know about Shoutcast & Icecast.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
In DataGridView control New row is always present. Is there any way If I dont want to display this new row because the data I am presenting in it to user is readonly.
Saqib
|
|
|
|
|
Set the Read only Property of Datagrid to true
Navi
|
|
|
|
|
I have already done this. My problem is not making ReadOnly but it is rather I dont want to show NewRow that appear with * sign.
Saqib
|
|
|
|
|
just set AllowUserToAddRows property to false.
Saqib
|
|
|
|
|
Hi all.
(windows forms).
How I can get the text of a textbox that is on other app?
Example:
I have an app running that has a textbox which Text property is "MICROSOFT VISUAL STUDIO ROCKS!".
I want to make an application that will obtain the handle of that textbox and get its contents (its text property value).
Please help me.
Thx in advance.
Best regards,
Marco Alves.
|
|
|
|
|
It depends...
Do you control the code of the other app?
Offcourse it's much more complicated if you don't.
|
|
|
|
|
No, I don't have the control of the other app.
|
|
|
|
|
Hello guys,
I found that there is a problem with carring out a simple "SELECT" query with the KEYWORD "LIKE". Here is the code:
/////////////////////////////////
string sqlStr= "SELECT * FROM FilesData WHERE FilesData.FileName
LIKE '*filename.txt*'" ;
OleDbCommand oleCmd = new OleDbCommand();
oleCmd.CommandText=sqlStr;
OleDbConnection conn = new OleDbConnection("Provider = Microsoft.Jet.Oledb.4.0; Data Source = zbooboo.mdb");
conn.Open();
oleCmd.Connection = conn;
OleDbDataReader reader69 = oleCmd.ExecuteReader();
////////////////////////////////
The reader69.read() does not return any results while results are present in the table.
This code is working when the keyword "LIKE" is omitted.
Hope you can help me out with this one.
Thanks, Ofir
|
|
|
|
|
Try to use '%' instead of '*' as placeholder.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks, It is working now ...
It is so strange that while writing the SQL statement in the SQL editor within access ENV. it is working with '*' and when doing it from the .NET ENV. it is working with '%' ...
Anyway, thanks a lot
|
|
|
|
|
string sqlStr= "SELECT * FROM FilesData WHERE FilesData.FileName <br />
LIKE ('%filename.txt%')" ;
|
|
|
|
|
Thanks, It is working now ...
It is so strange that while writing the SQL statement in the SQL editor within access ENV. it is working with '*' and when doing it from the .NET ENV. it is working with '%' ...
Anyway, thanks a lot
|
|
|
|