|
use this, to know about editing mode
DGV[ColumnIndex, RowIndex].IsInEditMode
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thank you,
I can figure out if the cell is in edit mode, but if this is true, I may not be able to select other rows than the row where my editing cell is in .. ?
Is there a way I can do that?
Thanks
|
|
|
|
|
there are vary events that can be use, try
CellLeave and CellEnter
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I've used this events, and with those, I can capture if I clicked on the other row etc.
But how can I prevent that the row I've clicked is not selected?
I've tried:
if (e.RowIndex != previous_line)
{
// There may not be clicked
MessageBox.Show("You are already editing a machine");
grid_machines.Rows[previous_line].Selected = true;
}
this results in the previous line, which is now selected again, but the arrow on the rowheader is still on the 'new' clicked row. So my old line is selected, but the new line has the editing arrow..?
Thank you
|
|
|
|
|
write
dataGridView1.SelectedCells = null;
or
dataGridView1.SelectedRows = null;
before select the previous row
hope it will work
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Those properties are get only, not set?
I understand what you mean though.
Would it be possible to override the event where the 'selection' of the row happens?
So that I look for my conditions, if it's false, then select the new clicked row ...?
Thank you
|
|
|
|
|
ooppss...i didnt check them, but here is working one
DGV.ClearSelection();
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi all,
When I double click on a ListViewItem, I don't want the checked property
of the item to change. By default, this does happen and I can't see a way
of disabling this behaviour.
Thanks in advance.
amit
|
|
|
|
|
I don't think you can.
The events occur in this order:
ItemCheck
ItemChecked
DoubleClick
MouseDoubleClick
so it's not possible to tell whether the change is occurring because of the double click until after the check has been changed.
Dave
|
|
|
|
|
Hi!
Trying to set the checked property in the CheckedChanged event doesn't work directly, but with a litte trick you can achieve this:
Call a delegate for resetting the Checked state using BeginInvoke() , so that the code is executed after the CheckedChanged event handler is through.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I'm trying to get the namespace that a class resides in within a static method of that class.
this.GetType().Namespace; works if the method is not static but obviously this is not valid in a static method.
Edit:
I've found that this way works but I'm sure there's a better way!
private class dummy
{ }
static string GetNamespace()
{
dummy temp = new dummy();
return temp.GetType().Namespace;
}
Dave
modified on Monday, March 3, 2008 7:52 AM
|
|
|
|
|
You can simply use typeof(MyClass).Namespace.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Thanks Tom, it works and will solve my problem but I was looking for a more general way if there is one.
The static method must already be in a class, so surely it should know what MyClass is without me having to specify it?
Dave
|
|
|
|
|
This works!
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Namespace;
Dave
|
|
|
|
|
You could always do this with the StackFrame. Here's a quick sample:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace TestApp
{
class Program
{
static void Main(string[] args)
{
StackFrame sf = new StackFrame();
Console.WriteLine(sf.GetMethod().DeclaringType.Namespace);
}
}
} GetMethod has a property called DeclaringType which returns the type of the class the method is implemented in, and from there it's trivial to find the namespace.
|
|
|
|
|
Cheers Pete, I actually found and posted the solution at the same time as you!
I used System.Reflection.MethodBase.GetCurrentMethod() instead of StackFrame.GetMethd()
Are there any advantages of either one?
Dave
|
|
|
|
|
DaveyM69 wrote: Cheers Pete, I actually found and posted the solution at the same time as you!
I used System.Reflection.MethodBase.GetCurrentMethod() instead of StackFrame.GetMethd()
Are there any advantages of either one?
Well, the StackFrame always implicitly returns MethodBase information, plus it returns line and file information if it's a debug build (obviously no line/file info should be returned for a release build). So, no real benefit of either one.
|
|
|
|
|
Hi,
I need to display the contents of a spreadsheet document in a listView or dataGrid. The code that I have opens the document, but only prints the first column's data. I need it to print all the data. I also need to add a new column in the spreadsheet as it loads. Please help!
Regards,
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
|
Hi,
thanks for the reply, but I saw this article and the listView does not display the contents of my spreadsheet properly. It only displays the first column.
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
Good Afternoon All
An new in C#, i have been doing Ado.net in vb.net. i want to use a Stored Procedure to do my database work, and i want to tell my command object that we are going to use a StoredProcedure. if i try this
<br />
<br />
cmdselect.CommandType = CommandType = StoredProcedure;<br />
<br />
I get an Exception that says
The Name StoredProcedure does not Exists in the current context
i have googled and my line looked ok, but i dont know what is wrong with this line
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
|
hi Thanks for your Reply
like this
<br />
cmdselect.CommandText = "get_me";<br />
<br />
cmdselect.CommandType = CommandType = StoredProcedure;<br />
"get_me" is the name of the Procedure.
and this is how i wrote my code, what is Wrong ?
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswa wrote: and this is how i wrote my code, what is Wrong ?
Since this code would generate a compiler error, surely the error message would be able to pinpoint where the error is.
Try:
cmdselect.CommandType = CommandType.StoredProcedure;
Note the dot instead of the second equals sign.
|
|
|
|
|
Thanks it worked
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|