|
Thank you very much for reading and helping me.
I am now working with my degree final year project. I want to use a progress bar with style set to marquee to show a progress. However, I found that the progress bar does not scroll while I am running my project.
I have tested in a new project with only putting a progress bar with style marquee. It works smoothly. On the other hand, even if I new a form in my working project (the FYP one), and just putting a progress bar on it, it still cannot work. I also found that the appearance of the progress bar is flatten just like a disabled textbox.
May I know is there anything I have set it wrong?
I am new with C#. Thanks a lot for guiding me!
|
|
|
|
|
Post some sample of how you're trying to do it.
|
|
|
|
|
Thank you Zoltan. I guess that I did not include EnableVisualStyles() before newing the form.
I tried this and the progress bar did run.
I wonder why it does not need to enable visual style if I put a progess bar with marquee as style in a brand new project.
|
|
|
|
|
Because, by default, EnableVisualStyles is already turned on. Start a new Windows Forms project, then open the Program.cs file and you'll find it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you very much Dave~!
Seems that I have asked a stupid question.
|
|
|
|
|
I want 2 change a particular color in gif image...... for example want to change the hair color according to user choice how I do dat Can any buddy give any idea......set pixel is very sklow anything else..........
|
|
|
|
|
I've been trying to implement the code found here, and everything works like a charm as long as all the machines I'm checking are up, but the thing freezes if one or more of them is down. I ran through with the debugger, and it freezes while executing the line I marked in the code below:
<br />
.<br />
.<br />
.<br />
try<br />
{<br />
start = Environment.TickCount;<br />
<br />
byteCount = socket.SendTo(sendBuffer, IcmpPacket.ICMP_PACKET_SIZE, SocketFlags.None, server);<br />
<br />
if (byteCount == SOCKET_ERROR)<br />
{<br />
result = PingResponseType.ConnectionError;<br />
response.ResponseTimes[i] = Constants.InvalidInt;<br />
}<br />
else<br />
<br />
byteCount = socket.ReceiveFrom(receiveBuffer, 256, SocketFlags.None, ref client); <br />
<br />
stop = System.Environment.TickCount;<br />
.<br />
.<br />
.<br />
in Ping.cs.
Again, this problem occurs only when a machine is offline (I've been unplugging one of them from the network to test it). I don't get an error or timeout, like I should. The program simply freezes.
I know this error is pretty darn specific, but hopefully someone out there has had some experience with it. I'm willing to provide any other pertinent details as necessary.
Thanks,
Sean
|
|
|
|
|
i have a string for example "i have a book".
i need to split it into many pieces and save it as an array string in condition that if a space found in the string split and save....
please help
thanks allot
|
|
|
|
|
string text = "i have a book";
string[] pieces = text.Split(' ');
|
|
|
|
|
thanks allot...
|
|
|
|
|
Hi,
I have a simple dialog box containing a ProgressBar and a label. I need to show progress for a lengthy operation with both a bar and some text.
I created a public method that takes care of incrementing the progress value, and setting the text for the label. When I run it though the bar shows the progress, but the label is all messed up (it doesn't update, and the dialog is all messed up where the label should be.)
I also tried setting the dialog's Text inside that method, but it's worse: after a few iterations the bar stops updating.
Has anyone seen this behavior? Is there anythign I can do?
thanx
|
|
|
|
|
Can you post a code sample here?
Are you trying to use another threads too?
|
|
|
|
|
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
|
|
|
|