|
What kind of device are you working with?
Keep It Simple Stupid! (KISS)
|
|
|
|
|
Try using WMI to get the device.
Glad to discuss with you and best wishes.
|
|
|
|
|
getting the row index in c#
|
|
|
|
|
rowindex in which control
cheers,
sneha
|
|
|
|
|
Hi everybody,
I am unable to get the index of the row which is selected by the user through checking a checkbox.
After getting the index I want to delete the row directly from the datagrid on that particular index.
There is no interaction with the datagrid..
Please help me out.Its urgent...
cheers,
sneha
|
|
|
|
|
Well, seeing as it's urgent!
How about using the CurrentRow property of the DataGrid?
|
|
|
|
|
You mean to say the "currentrowindex" property.But it's not working.
Give me some idea.
I am using this code to update the row according to the user's input.
protected void BtnUpdate_Click(object sender, EventArgs e)
{
dt = (DataTable)Session["Cart"];
CheckBox chkSelected = new CheckBox();
foreach (DataGridItem dgItem in DataGrid2.Items)
{
chkSelected = (CheckBox)dgItem.FindControl("chkSelection");
if (chkSelected.Checked == true)
{
TextBox TxtQTY = (TextBox)dgItem.Cells[2].FindControl("TxtQTY");
int Txt2 = Convert.ToInt32(TxtQTY.Text);
Label lblProduct_Id = (Label)dgItem.Cells[0].FindControl("lblProduct_Id");
string id2 = lblProduct_Id.Text;
Label lblDescription = (Label)dgItem.Cells[1].FindControl("lblDescription");
string desc2 = lblDescription.Text;
Label lblPrice = (Label)dgItem.Cells[3].FindControl("lblPrice");
float price2 = Convert.ToSingle(lblPrice.Text);
Label lblCost = (Label)dgItem.Cells[3].FindControl("lblCost");
float cost2 = Convert.ToSingle(lblCost.Text);
float final_cost = price2 * Txt2;
DataRow myrow = dt.NewRow();
myrow["REF"] = id2;
myrow["Description"] = desc2;
myrow["QTY"] = Txt2;
myrow["Price"] = price2;
myrow["Cost"] = final_cost;
dt.Rows.Add(myrow);
dt.AcceptChanges();
Session["data"] = dt;
}
}
DataGrid2.DataSource = dt;
DataGrid2.DataBind();
}
cheers,
sneha
|
|
|
|
|
You can get the index of the checked row DataGridViewCellEventArgs in the CellContentClicked event.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
Hi,
I am using datagrid not the datagridview.Please give me an idea for datagrid.Believe me I tried a lot but I am unable to do this.
cheers,
sneha
|
|
|
|
|
hi,
instead of using foreach, use for(int rowindex=0;rowindex<dtg.items.count;rowindex++)>
.thus 'rowindex' will giv the rowindex...try this....
|
|
|
|
|
|
Nikki05 wrote: Am just in my highschool.
So ask your teacher, thats what they get paid for. The idea of CP is to help people with specific problems, not do their (home)work for them. If someone gave you the code what would you learn? How to Copy and Paste?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Pls help me in implementing kerberos authentication in web application using C#...
|
|
|
|
|
Repost[^]
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
I have an applications which uses many stored procedures and is to be deployed on laptops. It uses SQL server express. When users shut their machine the stored procedures will vanish. Now I have two ideas of how to tackle this:
1. Create all the stored procedures every time the application starts or
2. Create all the stored procedures at the windows start up (ideal)
Which option do you recommend? How can I do option 2--if better?
How would you tackle such a situation?
Visual Basic is for basic people, C# is for sharp people.
|
|
|
|
|
What do you mean the stored procedures vanish?
|
|
|
|
|
3. Fix the problem.
I've had stored procedures disappear, but not consistently.
Perhaps you don't commit the stored procedure creation?
4. Don't use stored procedures; they're so last century.
|
|
|
|
|
PIEBALDconsult wrote: 4. Don't use stored procedures; they're so last century.
What? Use embedded sql in your apps so they have to be deployed to all users for simple changes? Not really abstracting your data access is it?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
PIEBALDconsult wrote: 4. Don't use stored procedures; they're so last century
I don't know where you get that idea from?
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hello guys!
I have a little problem with my first C# program.
I'm making a room cam controller with my webcam. What it does is, time to time, it connects to the cam and take a pic. No big deal.
My problem is, when the cam is in use (in MSN for example), the instruction that connects to the cam
SendMessage(mCapHwnd, WM_CAP_CONNECT, 0, 0)
opens a Dialog asking me to select the device to use (in my case i only have one webcam)
How can i bypass this? I mean, if it cannot connect it just don't take any pic, it wouldn't be any problem. The problem is that it starts to fill the screen with Dialog Boxes, so what i really want is avoid the Dialogs.
Please help
|
|
|
|
|
I was intrigued - so googled "sendmessage webcam dialog"
Is this[^] of any help?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
... it doesn't really helps, at least to me, there is some visual basic stuff in the page i don't understand... maybe there is some kind of handler i can create to kill the dialog?
|
|
|
|
|
Hi All,
I am having problems trying to get the selected index and subsequently the datakey value within a gridview , when a button is selected for a particular row.
Ive used the following event handler to fire the action yet the index is -1 regardless of which row is selected and the datakey value is null.
Some help on this would be great. Thanks.
heres my code
<br />
<br />
<asp:sqldatasource id="SqlDataSource1" runat="server" xmlns:asp="#unknown"><br />
ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString %>" <br />
SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName], [ContactTitle] FROM [Customers]"><br />
</asp:sqldatasource><br />
<asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" xmlns:asp="#unknown"><br />
DataKeyNames="CustomerID" DataSourceID="SqlDataSource1" <br />
Width="453px" onselectedindexchanged="GridView1_SelectedIndexChanged"><br />
<columns><br />
<asp:commandfield showselectbutton="True" /><br />
<asp:boundfield datafield="CustomerID" headertext="CustomerID" readonly="True"><br />
SortExpression="CustomerID" /><br />
<asp:boundfield datafield="CompanyName" headertext="CompanyName"><br />
SortExpression="CompanyName" /><br />
<asp:boundfield datafield="ContactName" headertext="ContactName"><br />
SortExpression="ContactName" /><br />
<asp:boundfield datafield="ContactTitle" headertext="ContactTitle"><br />
SortExpression="ContactTitle" /><br />
</asp:boundfield></asp:boundfield></asp:boundfield></asp:boundfield></columns><br />
</asp:gridview><br />
<br />
<br />
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
int i = GridView1.SelectedIndex;<br />
string datakeyval = GridView1.SelectedDataKey[i].ToString();<br />
}<br />
|
|
|
|
|
Is it possible to ping a port? like pinging an IP address + port.
Although I created an application that does this but it is inefficient and slow because I try to access a certain port using a try-catch block....
|
|
|
|
|
Silvyster wrote: Is it possible to ping a port? like pinging an IP address + port.
No. You cannot ping a port, just the IP address.
Silvyster wrote: that does this but it is inefficient and slow because I try to access a certain port using a try-catch block....
That's about the only way to find out if a server is listening on said port.
|
|
|
|