|
No, it's all on the same thread.
The code is something like this:
MyProgressDlg progress = new MyProgressDlg();
progress.Maximum = 1000;
progress.Text = "Adding Products...";
progress.Show();
for(int i=0;...blahblahblah)
{
progress.ShowProgress("Processing" + i);
}
progress.Close();
in MyProgressDlg
public void ShowProgress(string text)
{
label1.Text = text;
progressBar1.Value++;
}
thanx
|
|
|
|
|
Try using:
public void ShowProgress(string text)
{
label1.Text = text;
label1.Refresh();
progressBar1.Value++;
progressBar1.Refresh();
}
That should solve the problem for the label.
For the responsivness of the UI you should use different threads for the work or calculations done and the update of the progress dialog.
For more information check out this
article[^]
|
|
|
|
|
Right after you update the label or the progress bar, make a call to Application.DoEvents() . This will give your application time to process it's message pump and respond to the pending WM_PAINT messages that are stacking up because of your code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Hey all,
I wrote an ImageCombo control, inheriting from ComboBox .
In my attempt to design the control as close as possible to the original design pattern used for collections controls I have also written a ImageCombo.ImageComboItemCollection class.
I keep looking at the ListView control and other stuff to get an idea of the design pattern.
If you open your Object Browser you'll see that ListView.ListViewItemCollection implements the following interfaces:
ICollection , IEnumerable , and IList .
However, if we look at the IList interface for example, the arguments in most of its methods are objects.
Now take a look at ListView.ListViewItemCollection ... aaaaand... Aha!
Somehow they've managed to implement IList and hide Add(object) from the users!
Users can now only use the other overloads of Add() ! (e.g. Add(ListViewItem) ).
How is it possible?
How can I implement IList and hide the Add(object) method?
Thanks in advance,
Shy.
|
|
|
|
|
Actually, I think I might have been mistaken... I'll get back to you on this...
|
|
|
|
|
Cooooool!
Very nice indeed...
Now that's something you don't learn every day...
But isn't it breaking OOP rules??
I guess it does...
What's the purpose of this hiding ability than?
I can also guess it may cause a lot of trouble in some occasions.
What if someone tries to cast your object to the interface, and call the method?
It would propbably crash, right?
-- modified at 15:34 Tuesday 20th March, 2007
It seems that the private new syntax does not work...
The compiler still tells me that my class does not implement the interface.
Moreover it generates warnings saying the new keyword is not necessary as it does not hide any method.
|
|
|
|
|
Another thing...
How did they manage to hide the this[int] indexer?
Even if you declare it as private new you can't create your own indexer, as it would have the same argument type as the private one...
What's happening here??
|
|
|
|
|
Well... I've found the solution...
When looking at the Object Browser I've noticed that no access modifiers were declared for all of the IList methods which ListViewItemCollection implements.
For example: int Add(object value)
After a little journy of trail and error, I figured that if I combine explicit implementation (i.e. writing the name of the interface and a dot before each method name, like so: IList.<Method Name> ), and omit any access modifier, the method would not be accessible.
So now my code looks like this:
public ImageComboItem Add(string text, int imageIndex)
{
}
int IList.Add(object value)
{
if (!(value is ImageComboItem))
throw new InvalidCastException(...);
} Of course the IList.Add() implementation is meaningless, as the method is not accessible from the outside...
Further more, if I add the private modifier, the compiler complains that private is not valid for this item.
However when I omit the access modifiers, the Object Browser shows that the method IS INDEED private...
Can anyone explain this behavior?
What's the purpose of this ability?
Thanks in advance,
Shy.
|
|
|
|
|
It appears that this is a way to add an interface method to your class that is ONLY accessible from the interface. So, in your example, if your class is called "MyClass":
{
MyClass myClass = new MyClass();
// This does not compile
myClass.Add(new object());
// This compiles because the method is accessed throuh the interface
(myClass as IList).Add(new object());
}
I was mistaken before. You cannot hide an interface method.
|
|
|
|
|
I see...
Thanks again...
|
|
|
|
|
Hi,
We are building a custom reporting solution for our team. The reporting solution is a database driven application. I am working on the class library (Business layer) for this project. This class library would support the reporting UI to make database calls and to implement business logic. Additionally the class library would do validation, exception handling and logging, and configuration.
I have the following namespaces in my project which have their own folders.
1. Model – This folder would hold classes which represent the entities in the application. Each of these entities support database insert, update and delete operations for them.
2. Configuration – This would hold the configuration(setup) data required for a reporting UI to build a report. This would contain classes that it would return back a list of available fields in the database which are available for drill down and for reporting purposes.
3. Common – This folder would contain enumerations and other classes that the UI would need to reference.
The problem is that I am not able to find a good place for Validation objects and exception handling objects in the current setup I have. My question is that, what are the namespaces/folders you have generally come up with while working a database driven class library.
|
|
|
|
|
Greetings
I have a Gridview which contains several dropdownlists.
I need to program everything in c#
Question 1
When I press a certain button (not on the gridview) then I want to change the value of a dropdownlist in a certain row so that the selected value changes with this dropdownlist.
Question 2
How can I programmatically go through each cell in the gridview and determine which object is attached to this cell (dropdownlist, combobex , text field etc.
And determine if it is a dropdownbox what the selected value is in that cell + the DataValueField + the DataTextField.
I need to gram in c# since I have to create and change everything dynamically.
Hope somebody can help me out.
Thanks for all info
Greetings Peter Bellen
bellenp@schneider.com
|
|
|
|
|
I want to make a FileOpenDailog Box , but instead of opening files to select on local computer , I want it to open Files on a FTP server , starting from root directory , showing File and folder as they would appear on normally FileOpenDailog Box further when a file is selected OnOK should download the file to select folder on local computer , any suggestion are welcome , please write to aamir02@tpg.com.au
Aamir
|
|
|
|
|
Hey
When I run my application on windows 2000 I get this exception. But I can't even catch the error! It's something in windows (don't know).
The strange thing is that I can run the application perfect on a windows XP computer...
And when I remove all my threads from my application it works fine to
My application has 1 thread for the GUI and on for the domain (I just start a threadpoll in my panel which calls my facade to do something). On windows XP it works but not on the rest
Thx for the help!
&<log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2"><event logger="InterfaceCollector.domain.DAL.ApplicationDirector" timestamp="2007-03-19T21:02:14.2479872+01:00" level="INFO" thread="4" domain="Data Collector II.exe" username="AGVMSTUDENT\Administrator"><message>Collecting interfaces...<properties>
<event logger="InterfaceCollector.domain.DAL.WindowsSystemScan" timestamp="2007-03-19T21:02:15.8603056+01:00" level="ERROR" thread="4" domain="Data Collector II.exe" username="AGVMSTUDENT\Administrator"><message>Error processing .Ink File.<properties><exception>System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
at InterfaceCollector.domain.DAL.IShellLinkA.GetPath( StringBuilder pszFile, Int32 cchMaxPath, WIN32_FIND_DATAA& pfd, SLGP_FLAGS fFlags)
at InterfaceCollector.domain.DAL.ShellShortcut.get_Pa th() in C:\Documents and Settings\AWYDZ\My Documents\Visual Studio 2005\Projects\Data Collector II\Data Collector II\domain\DAL\MainFlow\ShellShortcut.cs:line 80
at InterfaceCollector.domain.DAL.WindowsSystemScan.pr ocessInk(FileInfo nextFile) in C:\Documents and Settings\AWYDZ\My Documents\Visual Studio 2005\Projects\Data Collector II\Data Collector II\domain\DAL\MainFlow\WindowsSystemScan.cs:line 172
&<log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2"><event logger="InterfaceCollector.domain.DAL.ApplicationDirector" timestamp="2007-03-19T21:03:58.7482512+01:00" level="INFO" thread="8" domain="Data Collector II.vshost.exe" username="AGVMSTUDENT\Administrator"><message>Collecting interfaces...<properties>
<event logger="InterfaceCollector.domain.DAL.WindowsSystemScan" timestamp="2007-03-19T21:03:59.5994752+01:00" level="ERROR" thread="8" domain="Data Collector II.vshost.exe" username="AGVMSTUDENT\Administrator"><message>Error processing .Ink File.<properties><exception>System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at InterfaceCollector.domain.DAL.IShellLinkA.GetPath( StringBuilder pszFile, Int32 cchMaxPath, WIN32_FIND_DATAA& pfd, SLGP_FLAGS fFlags)
at InterfaceCollector.domain.DAL.ShellShortcut.get_Pa th() in C:\Documents and Settings\Administrator\Desktop\Data Collector II\Data Collector II\domain\DAL\MainFlow\ShellShortcut.cs:line 80
at InterfaceCollector.domain.DAL.WindowsSystemScan.pr ocessInk(FileInfo nextFile) in C:\Documents and Settings\Administrator\Desktop\Data Collector II\Data Collector II\domain\DAL\MainFlow\WindowsSystemScan.cs:line 163
&
Olivier! Thx!
|
|
|
|
|
That is usually either a hardware error or a pointer error. With C# I doubt you are reading past a pointers allowed area.
File Not Found
|
|
|
|
|
It's on all the 4 windows 2000 PC's I tested
gtz
|
|
|
|
|
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt
is what I am going on. When I write c++ code I get this error from writing to memory I don't have access to (oops). So since you are using a COM component there could likely be differences across the OS version. Beyond that I will keep my mouth shut because I don't have any other ideas.
File Not Found
|
|
|
|
|
And how Can I lose this dependency?
thx
|
|
|
|
|
Hello,
Is there any way, or are there any tools to debug code used for design-time stuff by step-by-step debugging, breakpoints, etc.?
Thanks in advance,
Shy.
|
|
|
|
|
In visual studio you have a wonderfull debugger. just place breakpoints (in the column on the left) and use F10 or F11 to go step by step.
gtz
|
|
|
|
|
Normally, all you have to do is create a second project in the same Solution as your control project and create an instance of the control your testing in it. Set breakpoints as appropriate and start the test project.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you both for your replies Ollie1986 and Dave Kreskowiak,
However, I think my intentions were not clear enough.
I do not wish to debug the code during application runtime, but rather at design-time.
Its possible that I didn't understand you both, but when I set breakpoints and keep designing my controls, they don't break code execution...
Help...?
|
|
|
|
|
It is possible. You need to start a second instance of the IDE and attach the debugger
to the first instance of the IDE (the one that you're using to design).
In the second instance of the development IDE use Debug -> Processes
In the Processes window select the first instance of the IDE and press Attach.
Kind of hard to explain
Maybe this will help[^]
|
|
|
|
|