|
hi Luc Pattyn,
actually i wanna to thank u for ur efforts to help me.
first i think the problem is that i donot understand
BackgroundWorker well (it is very complicated)
so i tried before using it to use normal thread but i failed
but now i knew my error and i fix it in the normal thread not the BackgroundWorker Thread and now no(unreachable code,memory leak ...)these things are not found now
any way thanx to u very much
bye
Generator
|
|
|
|
|
|
Is there a way to access each of the controls in a form by name programmatically?
i.e. without having to loop through each one
Tia.
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
Yes,
use the Controls Property of a Contailer like Form or Panel:
<br />
Control c = Controls.Find("name", true);
Control c = panelXYZ.Controls.Find("name", true);
|
|
|
|
|
If I have a class with an event, and a class that wants to attach to the handler:
class A
{
public event EventHandler<SomeEventArgs> SomeEvent;
}
class B
{
public void AttachToHandler(A a)
{
a.SomeEvent += ***;
}
void SomeEventHandler(object sender, SomeEventArgs e) {... }
}
The VC# Express IDE ("press TAB to insert..") suggests:
a.SomeEvent += new EventHandler<SomeEventArgs>(SomeEventHandler);
However, the following also seems to work:
a.SomeEvent += SomeEventHandler;
Now the questions:
Is there a difference between the two? A "preferred style"?
|
|
|
|
|
I've always used the first method (using the New operator to instantiate a new delegate that will handle the event).
You can alway declare a variable that holds the reference to the event handler in advance and then use that as your handler like so:
<br />
<pre>
EventHandler eh;
eh = New EventHandler(SomeEventHandler);
a.SomeEvent += eh;
</pre><br />
<br />
this way you could later detach the event handler too, like so:<br />
<br />
<code lang="C#"><br />
<pre>
a.SomeEvent -= eh;
</pre><br />
<br />
The second way seems to be a shortcut for the first (in which the compiler automatically generates the code that instantiated the delegate and than passes it your function).<br />
<br />
Hope this helps, but your best bet is to do some reading on delegates and event handlers in C#. <br />
<br />
<br />
<br />
<div class="ForumSig">----<br />
<a href="www.digitalGetto.com">www.digitalGetto.com</a></div>
|
|
|
|
|
Hi,
I would like to have a ComboBox with multi-select, which is similar to ListBox (but ListBox has no DropDown). Could someone here give me some help? Thanks in advance.
BTW, I use Microsoft Visual Studio .Net 2005.
Regards,
Amatista
|
|
|
|
|
Why would you want to do this? A ComboBox can only show a single selection at a time, when the list is not dropped, so therefore, a MultiSelect ComboBox makes no sense; which is why it's not an option ...
|
|
|
|
|
Thanks for your reply.
I am in charge of designing a full-text searching tool, a windows application, and the ComboBox is used for user to select file types for searching. I think it would be better if the user can select more than one file types. For the selected file types, if more than one item, they should be displayed, either comma or semicolon separated. Or is there another tool instead of ComboBox that I can use?
Does anyone have any suggestions to solve this issue?
|
|
|
|
|
You should either be using a group of check box controls or a CheckedListBox. What you're wanting to do, goes against the standard design for that control.
|
|
|
|
|
Thanks for the information.
|
|
|
|
|
I have a program which has a bunch of user controls. (Talking in the hundreds here) You can basically consider these controls as a bunch of buttons, with 2 images taken from the hard drive as Up and Pressed states. (The images are stored in memory when the control is first created, so there isn't any delay getting them from the hard drive.)
My problem is that when the program is minimized and then maximized, all the user controls redraw themselves. Is there any way to stop this?
Now, bearing in mind that RAM is not an issue, (well as long as it doesn't use more than 300MB or so of it anyway :P ) so if the only way to fix this is to use lots of memory, I don't mind.
Any suggestions?
PS. I'm assuming that the Windows GUI is discarding the conrol graphics as soon as they're off screen to improve performance. If this is true, then a way to stop this would be appreciated. (Also making it all get painted at the same time on startup would be appreciated. A slight delay while loading up the program would not matter)
Note: Using UserPaint, AllPaintingInWmPaint and DoubleBuffer doesnt help.
- Munty
|
|
|
|
|
When you minimize the window and maximize it back the controls have to redraw themselves because there was no part of them visible before for windows to perform local invalidation and restore data from internal cache...
If you want the maximum speed try caching the images into variables and render them to the form with unmanaged code (the BitBlt function[^] if I am not wrong).
Hope it helps ....
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Hi,
I have a Windows service, which should be installed using MSI.
The installation goes well.
When i run the MSI again to uninstall the service i have no errors occurred, but the service is still there and also the installation files.
Does anyone has any idea?
Thanks!
Vadim G.
|
|
|
|
|
Did ya stop the service first? and if so, did the service actually STOP?
If you attempt to uninstall a running service, that won't work.
"That's an idea."
|
|
|
|
|
Thank you for reply.
But unfortunately i've already tried it -> unsuccessfully.
(It does succeed when i run InstallUtil)
|
|
|
|
|
How can I bind list with datagrid and textbox?
merwa
|
|
|
|
|
Perhaps you could explain better, maybe tell us the problems you are having.
only two letters away from being an asset
|
|
|
|
|
I am trying to display a moneyfield in a gridview but it displays as 14.9500 instead of 14.95$
Can anyone help please , I have tried editing as {0:c} and {0 .00} which works for a datalist but not for the display in gridview.
|
|
|
|
|
Create a template column and then in the label set the text to:
Text='<%# Convert.ToDouble(DataBinder.Eval(Container.DataItem,"moneyfield")).ToString("C") %>'
Hope that helps.
Ben
|
|
|
|
|
Hi,
Set the DefaultCellStyle.Format property of the column to c
HTH.
Hayder Marzouk
|
|
|
|
|
Thanks for your prompt reply but
when I edit Gridview columns I can't find this property.
|
|
|
|
|
Hi,
My response works in a .Net 2.0 Windows Forms application not is an ASP.NET Project.
So...
- Edit the gridview columns
- Select ure column
- Select the property DefaultCellStyle and click the button in the right.
- You will find the Format property in a new opened property form
- Set the property to c
HTH.
Hayder Marzouk
|
|
|
|
|
Thanks a lot for your help
I am using an ASP.NET web site.
|
|
|
|
|
Hi,
I have developed an application (i.e. a rss news reader) it reads news from any rss source.
Now the problem is that i have selected its position just over the taskbar and always on TOP ; issue is that my news reader overlaps all the applictions.
I want my RSS News Reader to appear as task bar appears (i.e. all application launched should be above as in the case of windows task bar)
Thank you!
"Mess with the Best, Die like the rest"
|
|
|
|