|
Hi,
Can you please elaborate that exactly what you want to do; because datagridview does have a CellClick Event.
Regards,
Ujjaval Modi
Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.
|
|
|
|
|
hi
i have a datagridview contrl which populates a column from table thru dataset.
when i click, or browse through arrow keys , the current cells items should be shown in textboxes for edition.(the selected cell item is key value, i pass it to storedproc and select its other fields to show in textboxes) i had did this through a button click as follows
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
dsGridToTxtBx = obj._selectGridCellAreaDetails(<big>DataGrdVw1.CurrentCell.Value.ToString(</big>));<br />
{<br />
AreaIdValue = dsGridToTxtBx.Tables[0].Rows[0].ItemArray[0].ToString();<br />
<br />
txtAreaName.Text = dsGridToTxtBx.Tables[0].Rows[0].ItemArray[1].ToString();
txtRegion.Text = dsGridToTxtBx.Tables[0].Rows[0].ItemArray[2].ToString();
<br />
}<br />
}
also i tried like this but this doesnt works?
private void DataGrdVw1_CellClick(object sender, DataGridViewCellEventArgs e)<br />
{<br />
string CurrentSelValue;<br />
CurrentSelValue = DataGrdVw1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();<br />
txtAreaName.Text = CurrentSelValue;<br />
}
i would thank if anybody gives me solution
kssk
kssk/div>
|
|
|
|
|
Hi,
Not sure why the following line gives an error mentioned below.
if (dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value = CheckState.Checked)
{
}
Cannot implicitly convert type 'object' to 'bool'. An explicit conversion exists (are you missing a cast?)
Even tried == instead of = but still does not work.
Thanks
|
|
|
|
|
well it definately wont work with one = as thats assignment. With 2 == i'm pretty sure you'll see a different error message saying that there is no implicit conversion to CheckState for the value of dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value
try using the debugger to see what the value of dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value actually is.
|
|
|
|
|
if (dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value == CheckState.Checked)
{
Operator '==' cannot be applied to operands of type 'object' and 'System.Windows.Forms.CheckState'
|
|
|
|
|
You need to cast the value to a bool before you can test it. Value is an object type, so you need to do this
if (Convert.ToBoolean(dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value) == CheckState.Checked)
|
|
|
|
|
if (Convert.ToBoolean(dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value) == CheckState.Checked)
I doubt CheckState will be able to equate a boolean any better than object would.
|
|
|
|
|
J4amieC wrote: I doubt CheckState will be able to equate a boolean any better than object would.
Ummm - but CheckState.Checked is a boolean. Have I missed some subtlety in the original post?
|
|
|
|
|
Pete O'Hanlon wrote: but CheckState.Checked is a boolean
I dont think so, CheckState[^] is an enumeration.
I might be wrong.
|
|
|
|
|
J4amieC wrote: I might be wrong.
Nope - you're not. Damn, I really need to get more sleep tonight.
|
|
|
|
|
Pete O'Hanlon wrote: Damn, I really need to get more sleep tonight
Yes, you are not yourself today.
|
|
|
|
|
I made the mistake of going food shopping for Christmas late last night and it was insane. So many people, so little food.
|
|
|
|
|
and have you done as suggested and debugged to see what the actual type of dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value is?
|
|
|
|
|
hi friend,
i have a datagrid. i m serching data with some textbox parameter. i want to edit it.
1. when i edit the cell and check the perticular row checkbox and click on edit button it should save into the database.
Can u guys help me out.
Vinod Kumar Gupta
|
|
|
|
|
SqlCommandBuilder scb = new SqlCommandBuilder(myda);
myda.Update(mydt);
myda is your dataadapter
mydt is your DataTable
|
|
|
|
|
Hi guys,
I have a datagridview. i can delete all rows, bud not the last row, i mean i can't never delete wen there is only one row remaind.
any idea how to fix this?
thanx.
|
|
|
|
|
hi dear,
what u r using to delete in GV. like checkbox or button. could tell me i can do something. if you clear this
thanks
"Good Thing Goes With Good People..."
|
|
|
|
|
Hi PTells,
thanx for your response, i m using a buttom for deleting.
|
|
|
|
|
Hi,
If you are writing your code to delete rows in datagridview's SelectionChanged event, then you will face this problem.
try writing the deletion code in datagridview's CellClick event.
Regards,
Ujjaval Modi
Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.
|
|
|
|
|
hi,
How do i handle refresh event of web browser on a windows form?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
how to check the box in the windows service containing "Allow System to interact with desktop" via c# code?Where should this method be kept?If we put this into the methods such as BeforeInstall() or AfterInstall(),Do we need to call it in our Service.cs file??
Please help me.
Thank u.
|
|
|
|
|
It is not possible with .NET. AFAIK, it's not even possible on the newer Windows versions.
xacc.ideIronScheme a R5RS/R6RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
Well Leppie,thanks for the reply...
but i think that it is possible to check the box containing "Allow System to interact with Desktop" via code.Here is the code...
RegistryKey ckey=Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\",this.ServiceName);
if (ckey != null)
if (ckey.GetValue("Type") != null)
ckey.SetValue("Type", ((int)ckey.GetValue("Type") | 256));
This code runs well and the box is checked,when I call it in myService.cs file.But I think that I got to do this in projectinstaller.cs file at the method OnBeforeInstall() and OnAfterInstall() accordingly.But my problem is that its not working when I put inside above methods.Could anybody suggest me the Right way??
Any type of advice is welcome.
thank u.
|
|
|
|
|
how to check the box in the windows service containing "Allow System to interact with desktop" via c# code?Where should this method be kept?Is we put this into the methods such as BeforeInstall() or AfterInstall(),Do we need to call it in our Service.cs file??
Please help me.
Thank u.
|
|
|
|
|
Don't know, but have you tried a google or msdn search?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|