|
Martin23 wrote:
I thought that this would set the progressbar going, then do the work, then stop the progress bar, but instead the progress bar just doesnt do anything, although the code to get the html data does work.
If the entire form that the progress bar is on locks up, along with the progress bar not moving (i.e. nothing is redrawn on the form), then it is probably because you are running your webpage code from the same thread. The way to get around this is to run the web code on a seperate thread (although you shouldn't update your ListBox from this new thread, as that will throw errors).
Hope that helps
Cheers,
Will H
|
|
|
|
|
Yes that does help, thnaks! Further problem now is how do I stop the progress bar? because if I put the code to stop the progress bar in the new thread, then that makes the progressbar disappears altogether when the thread finishes (why is that?), and I can't put the code like this;
Private void getWebData()
{
progressBar1.Style = ProgressBarStyle.Marquee;
progressBar1.Value = 100;
//start new thread to do everything
progressBar1.Value = 0;
progressBar1.Style = ProgressBarStyle.Continuous;
}
because then as you would expect it starts and stop the progress bar imidiately. I assume I have to somehow attach an event handler to the new thread so I know when it finishes?
thanks
Martin
|
|
|
|
|
Hmmm... Not sure. You could try an event handler, but I would take a look at this[^] article first (it explains GUI updation from different threads. I think it applies to FW v2, but I'm not sure)
Cheers,
Will H
|
|
|
|
|
Maybe you've already worked it out, but I had a play and if you stick the following code somewhere, and then call StopProgressBar() from the new thread (after all the web stuff), it should work.
private delegate void SetProgBarDelegate();
private void StopProgressBar()
{
if (this.InvokeRequired)
{
this.BeginInvoke(new SetProgBarDelegate(StopProgressBar));
return;
}
this.progressBar1.MarqueeAnimationSpeed = 0;
}
Cheers,
Will H
|
|
|
|
|
Wow, thanks Will, thats perfect!
I'll remember to pass your kindness on to someone else!
(plus I'll get a book on threading in .NET )
Martin
|
|
|
|
|
Glad I could help
Cheers,
Will H
|
|
|
|
|
I am a beginner for c# programming
in c
struct TT{
int a1;
int a2;
int a3[2][10];
}
and i can get the size of the struct by using sizof(TT), will be 88 byte
but how can i declare a struct like this in c#, and get the struct size = 88 byte;
i have try like this
struct TA{
int a1;
int a2;
public int[,] a3 = new int [2,10];
}
TA ta = new TA();
and i call Marshal.SizeOf( ta ) the size alway is only 8
how can i do ?can someone tell me why plz, and think a lot
|
|
|
|
|
Have a look at the MarshalAs attribute: MSDN[^]
---
b { font-weight: normal; }
|
|
|
|
|
thx for ur answer~~
i have already find MSDN for a while and sorry about my poor english, i can't find the answer that i want, i just want to get a struct like
struct TT
{
int a1;
int a2;
int a3[10][2];
}
in C#, and can u tell me how to write it in C# please tell me thx a lot
|
|
|
|
|
Did you look at the specific page in MSDN that I linked to?
---
b { font-weight: normal; }
|
|
|
|
|
I wanna learn about c#. I am green horn with c#. Where can I start. Please point out me.
thank in advance
|
|
|
|
|
|
thlaing wrote: I mean C#.net 2005. Thank you!
Please help me how can I start to learn C#.net. If you are not annoy with me, please help me.
thank in advance
best regards,
thanhlaing
See my previous reply - I gave a link to a very good book on getting started with C# 2005.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Try reading stuff on MSDN.com, specifically Coding4Fun
Or try to get a book from Sams (C# in 21 days is a good starter).
But make sure you learn by doing, otherwise you will never fully understand it.
PS - there is only one version of C#, therefore it is not called C#.NET specificall as it was designed in the first place for .net
|
|
|
|
|
James Gupta wrote: PS - there is only one version of C#, therefore it is not called C#.NET specificall as it was designed in the first place for .net
Actually, if we're going to get pedantic about it the MCSD exams I took all referred to "Microsoft Visual C#.NET" (note also the capitals in .NET) Microsoft Visual C#.NET (Core Reference)[^] published by Microsoft Press is another example where the full form name is used. However, most people just shorten it to C#
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
James Gupta wrote: there is only one version of C#
To my knowledge, there are two versions of the C# compiler (and nothing stopping more being available): Mono C#[^]
Remember that C# is a set of ECMA standards[^]
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
James Gupta wrote: Try reading stuff on MSDN.com, specifically Coding4Fun
Or try to get a book from Sams (C# in 21 days is a good starter).
But make sure you learn by doing, otherwise you will never fully understand it.
Sorry if I sounded like I was being overly pedantic. I have to say that I do agree with the other stuff that you say. Especially the bit about actually "doing". It is the best way to learn as it helps firm up the ideas in the mind. Another good way is to have to explain it to someone else as it concentrates the mind. So writing articles or giving presentations can help.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
I would like to make a layer(panel or picturebox) for making some annotation on the textfield?
I try to set the backcolor to empty or transparent, i also cannot make it transparent.
Which component should i use? how i can make it become tranparent?
Thanks in advance!!
|
|
|
|
|
One suggestion and a technique that I have used before is to use another form. On that form you can remove the boarder and set the transparent key. You can also set the Opacity to give a faded look. This technique requires a little more coding to handle but is easier then using APIs. That would be the other option; for that I think will need to get a book.
|
|
|
|
|
I want to create a button which would display the Operating system installed on the Computer. The Text box the info is to be displayed in is txtOS. When this happens, I want an image to appear in a picture box called pctOS1.
I want the images to show in pctOS1 to work for these OS:
Windows 2000
Windows ME
Windows 98
Windows XP
Windows x64bit
Windows Vista
Windows Server 2003
In the end we're all just the same
|
|
|
|
|
And the question is...?
---
b { font-weight: normal; }
|
|
|
|
|
Here is a simple version:
I have a Button that says get OS information. When Clicked I want it to display the current installed Operating System in a text box called txtOS. Depending on which Operating system is installed on users PC, i want a image (Wallapaer) of the OS to appear in a picture Box below. Like this:
If user has windows vista, In picture box Windows Vista background wallpaper will show.
If user has windows ME, In picture Box Windows ME background will show ect...
Sorry its hard to ecplain
In the end we're all just the same
|
|
|
|
|
Again, the question your asking is _________________________________?
All you've done is posted a list of things you want your program to do. What part of this are you having a problem with? Have you written any code for this? Are you looking for design suggestions? Are you having a problem determining the Windows version? Showing a picture? ____________________________________?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 11:34 Wednesday 1st February, 2006
|
|
|
|
|
Lets see... I can make this better to understand.
First I need help code for getting the computers OS when a button named btnOS is clicked. I want the OS to appear in a textbox called txtbxOS.
Also depending on what Operating System is on the users PC, I have created a Picturebox named pctOS and I want this to dispaly an image.
The PctOS will display a image of the current OS that is installed on users PC. I have a list of wallpapers stored in the same folder as the application. Here is an example:
If windows XP appears in the textbox txtbxOS I want the application to load up the wallpaper WindowsXP.jpg that is stored in the same folder as application and display it in the picturebox named pctOS.
Just say you have a listbox and you have 3 choices:
1) Car
2) Camera
3) Bike
when you click on bike, a bike image will display in the picturebox beside the listbox. I want the application to do this, but use the information in the textbox txtbxOS as information:
Example (txtbxOS Information in text box) (PctOS picturebox where image is to be displayed):
txtbxOS PctOS
Windows XP Home XPHome.jpg
Windows 98SE Win89SE.jpg
In the end we're all just the same
|
|
|
|
|
Boy, all that typing and you haven't written a single line of code.
You're not going to get anyone here to write this for you. You've got to do the research to get something started. At least an ATTEMPT to write the code.
Start simple. Just get the OS version and see what you can do with it.
Environment.OSVersion[^] docs
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|