|
Hi, i have a problem about datagridview.
When i apply a sorting operation on a datagridview, it sortes the items well, but changes the selected item (not selected index). Let me explain this:
For example, my sort column's values below:
aaa (selected)
bbb
ccc
ddd
after sorting:
ddd (selected)
ccc
bbb
aaa
It changes the selected item. But i want my first selected item will stay in selected.
Does anyone know how can i do this?
Thanks.
ozgur.nevres
|
|
|
|
|
Get the item selected before sorting. After sorting, re-select that item. Would that work for you?
|
|
|
|
|
I did this. I mean, is there any way to do this automatically. A property, or something...
I think the answer is no.
Thanks for your care.
ozgur.nevres
|
|
|
|
|
|
I am stuck with this problem from past one week .
Problem definition :A form shall have a minimum size .When the user changes the width of the form ,the height must also change by the same amount .Similarly when the height of the form changes the width must change by the same amount . In the below code only the width change and its corresponding height change is implememnted . The height change is yet to be done .
My Solution :
Overriding the OnSizeChanged
//This function shallbe contained in a simple Windows form
private bool bWidthCheckSize = true;
protected override void OnSizeChanged(EventArgs e)
{
count ++ ;
base.OnSizeChanged (e);
try
{
/*When the width is changed ,proportionately the height is also changed proportionately in the second if cond . But when the height is changed this event is triggered again .Hence bWidthCheckSize is made false before changing the height . Hence when this function is triggred due to change of height it just returns back ,by resetting the bWidthCheckSize flag*/
if(bWidthCheckSize == false)
{
bWidthCheckSize = true;
return;
}
/*Though the height is updated ,the updated height is lost as the event is called by itself .Hence every time the height is updated with the previous height . This is the cause of the flickering .I am wondering is there any work around .Moreover this logic does not hold good if I put the code for handling Fom Height change .*/
this.Height = this.prevHeight;
//Form Size Changed by width ,if current width is not equal to previous width
if(prevWidth!=this.Width)
{
//Get the difference in Width
int diffInWidth = (this.Width - prevWidth);
//Update the previous width
prevWidth =this.Width;
bWidthCheckSize = false;
//Update the prevHeight by the same amount ,the height would be increased
prevHeight += diffInWidth;
//Increase the height by the same amount
this.Height += diffInWidth;
}
return;
}
catch{}
}
Thanks in Advance ,Hope to receive a earlier response
|
|
|
|
|
To prevent flickering, I suggest turning on double buffering in your form, inside your form's constructor:
public Form1()
{
...
this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
}
protected override void OnPaint(PaintEventArgs args)
{
base.OnPaint(args);
}
|
|
|
|
|
Hi,
i want my application to authonticate through the windows Authontication..
meanin that if a user has entered the network domain.. i want my program to check through the active directory or whereever she needs to check , if the user is on a the list (and then he can have access to some speacical features) and if not(but still on the domain users list) to be able to access other features.
how do i accomplish this task through c#?
and if you can tell me how to configuire the active directory as well i will be grateful...
thanks YOSI
|
|
|
|
|
A simple web search is all you need: here[^].
|
|
|
|
|
In simplest terms -- i know it binds data but someone please make this make since to me
currencymanager???
thanks
|
|
|
|
|
Just a shot in the dark, but CurrencyManager is used to keep data-bound controls synchronized (current) with each other. Maybe that explains the name.
|
|
|
|
|
thanks but i need to know the logic of this class....
any articles???
or is someone able to give me a good explanation on the usage of this class
|
|
|
|
|
My application is using one registry value.Intially its value is TRUE. while Closing application the Value will be set to TRUE becoz i had handled the Close Event of application and set the Registry value to TRUE.so that when the application is open again the value should be TRUE, BUT if press i CTRL+ALT+DEL in between the running application.Close Event does not fire. Value remain FALSE in the registery value and my application does not work properly
Now my problem is where should i set the registry value to TRUE if i press CTRL+ALT+DEL in running application.
Amit Grover
CDAC R&D
|
|
|
|
|
Umm, maybe at startup?
I'd like to add, applications should never be designed to totally fail if a simple registry value wasn't set correctly. You have to code for the inevitable.
|
|
|
|
|
I'm assuming that you do more than just press Ctrl-Alt-Del, like selecting End Task in the Task Manager?
There is no way around this. End Task will TRY to close your application nicely, but chances are, the memory that your app is using will just be freed and your app dumped, without running any of its code! So, no, there is no way to catch this and run your Closing code anyway.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When adding refrences to other dll's in my solution, i run into a problem.
after editing, debugging, building(compiling) and saving the dll or reference
when running code in the class that uses the dll or reference i keep getting popup that says this file has been modified do you want to use this file. But it doesnt use the updated reference which makes the code act funny.
I am thinking the build order is wrong.....
How do i resolve this issue... hope this all makes since.
please let me know if you want me to explain something you dont understand
Thanks in advance
|
|
|
|
|
did u try this ....
copy the build dll to ur current project bin folder and refer it in the app
sathy
-- modified at 4:26 Thursday 29th December, 2005
|
|
|
|
|
Better idea. Don't set a reference to the .DLL file itself. Set a reference to the .DLL PROJECT. When you compile the application, it'll use the latest build of the .DLL automatically.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi i want to get the file name with path of that file that is (open, Rename, Delete, Modify) by the user. i use FSW (File system watcher class) it give me info about (Rename, modify, delete). but how i get event that which file is opened by the user by mouse or keyboard. Is there any class which capture events that any file is opened in a system. Plz reply
Mazhar
|
|
|
|
|
m_mazhar wrote: Is there any class which capture events that any file is opened in a system. Plz reply
No, there isn't. This requires hooking into the NTFS filesystem. Check out FileMon[^] at SysInternals. There is a list of references that was used (all books!) to build that utilities abilty to do just what you want.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I'm writing a C# add-in, I need the current project directory in my code (not the runtime IDE's projects).
e.g. I write code in C:\Documents and Settings\f-xidwu\My Documents\Visual Studio Projects\winConsole\winConsole.cpp, thus how can I get C:\Documents and Settings\f-xidwu\My Documents\Visual Studio Projects\winConsole path?
|
|
|
|
|
|
hi,Application.startpath or executablepath will lead to the application directory which contain the .exe file (sometimes debug directory), but not the project directory.
ps: an add-in's .exe directory is C:/Program Files/.../Comman7/IDE/ usually.
|
|
|
|
|
You can't get the project directory at runtime, simply because it's not the individual CS files that run the application, but the exe or dll built from them. The only way I know is to hardcode the strings inside the files themselves.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
My Application currently have an embedded MS Access Database, the Connection String as follow:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\..\\DataBase\\DataBase.mdb"
but every time when i publish my application and execute, it pops an Error message saying the Data Source Path is invalid. It seems like the Current Working Directory is somewhere in the memory, not the file location.
How can i setup it up so that no matter where the application is located, as long as the DataBase.mdb file is in the same directory, it knows where to find it?
Thanks alot
Need Help
Thank you very much
|
|
|
|
|
Hi all,
I'm making a ListView like a break point window, when someone insert a new breakpoint on the margin indicator or through the insert break point dialog, even when press F9, I want my listview to refresh.
I've searched a lot, but seems nothing useful. What should I do? what's the right event or command?
3x.;P
Xiaodao
|
|
|
|