|
I have a progressbar showing the progress of background operation , when i browse through other application and return to mine , the form takes time to redraw itself infact it is redrawn only when the progress is completed.
I went through various sites and found that this problem in delphi can be solved by using..Application.ProcessMessages...Any ideas do it in c#.
Shri
|
|
|
|
|
not sure how you are going about it, is it threaded ?
are you looking for Application.DoEvents() ?
need more information about your implmentation.
there is another post (recently) about how to achieve this with a backgroundworker thread
hth
g00fy
|
|
|
|
|
yeh with backgroundworker everything is fine....
wat I m trying is just a "for" loop whose value goes to progressbar.value using thread..then thru invoke function of threads...showing the progress in progressbar but while progressbar is working and u browse other application the windows form of mine take time redraw it self (it does not response from user)..want to make form responsive even if progressbar is functioning
Shri
|
|
|
|
|
If the operation is really done in a separate thread and the GUI thread isn't blocked otherwise this shouldn't occur. You should first check if you are really using your threads correctly and if the main thread is working on something.
Other than that (as already suggested) you can use Application.DoEvents() to make your form redraw. But be careful not to call this too often (with 'often' I mean many times per second) as it might reduce performance.
|
|
|
|
|
Thanks Robert and goofyman...Application.DoEvent()..works.
|
|
|
|
|
I have requirement of reading a remote file using ASP.Net (C#)
This is what I m doing
StreamReader sr=File.OpenText(<filepath>);
It give bad username and password error....
Can anyone help pls
Thanks,
Deeps
|
|
|
|
|
Check file access rights
Best regards, Alexey.
|
|
|
|
|
hi i m able to access this file outside .net.....i myself have created tht file....its only not accessing thro .net
Can anyone pls luk into this
Thanks,
Deeps
|
|
|
|
|
ASP.NET code is not run using your user acount (why would it), but a special account. The name of the accound depends on the version of IIS, but it's normally ASPNET or IIS_WPG. You have to grant permission to the file for this account.
---
b { font-weight: normal; }
|
|
|
|
|
Ya Guffa , this makes sense....but how do I grant these permissions to the file...Can u pls help
Thanks,
Deeps
|
|
|
|
|
Open the properties for the file and go to the security tab. If the user account is not listed, add it. Set read permission for the account.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
Thanks all of you for the replies. Thought to post the solution if anyone needs it. Access a remote file through Asp.Net is different from doing it thro a console or win appl as Guffa rightly pointed out. So to do this there is a class WebClient which can be used
Here's the code snippet
WebClient myclient= new WebClient();
Stream st=mycl.OpenRead(@"http://machine-name/filepath");
StreamReader sr=new StreamReader(st)
...
Then startreading the file using the streamReader.
Thanks
Happy Coding
Deeps
Thanks,
Deeps
|
|
|
|
|
That method is fetching the file using the HTTP protocol via IIS, instead of using the file system. That means that the file has to be publicly available (which is not always good), it adds a lot of overhead, and it increases the traffic through IIS.
---
b { font-weight: normal; }
|
|
|
|
|
hi can anyone tell me that when we provide a url and port number in object of TcpClient class what happens. I have defined the url as
string url="127.0.01"
intport=8888;
and then i have passed this way
TcpClient socketfor=new TcpClient(url,port);
can anyone please let me know the meaning of it.
|
|
|
|
|
|
The call will try to establish a Tcp connection to the specified url and port. The url is used to know to which host (computer) the connection should be established. The Url can be a normal adress (like http://www.codeproject.com) or like in your case an ip adress (actually the first one will be resolved to an ip adress on the fly). The ip "127.0.01" is always the local machine - thus the connection will be established to yourself. As every host can have multiple connections open the port number differentiates these connections.
Probably this description is a bit too simple (I'm no real expert on this) but it should give you a rough idea.
|
|
|
|
|
hi all,
i have an app and am wondering the best way to periodically check for updates or other events.
should i use the windows scheduller or just have a thread that sleeps alot? or another way?
which is best practice?
more often than not the period between checks would be once or twice a day. this i think is along time to sleep a thread.
any ideas pls?
kind regards,
g00fy
|
|
|
|
|
Personally I wouldn't use the scheduler. You have more control when doing it yourself.
You could even avoid having your own thread by using a System.Threading.Timer[^] class which manages this internally.
|
|
|
|
|
Hi
Is it possible to have a check box in a listview (windows application) column header and while checking this, all the check boxes in the column will be checked?
|
|
|
|
|
I don't think it is..
You could either drop a small button on to although that would be rubbish.
You could hide the column headers and have the first row of data being a dummy row, when you check its checkbox it checks all the others.
-- modified at 9:16 Friday 21st April, 2006
|
|
|
|
|
i have this column in an excel worksheet that contains hyperlinks to other documents. the rest of the columns contain regular values (e.g. Roger). the whole worksheet iotself would be exported to a datagrid using c#.getting these regular text values to display is fine but the probelm is that i can't get the url behind the hyperlink...
help me please.
thanks.
|
|
|
|
|
How are you fetching the data? If you do it with OleDb you probably won't have any luck. I think you need to use the Interop assemblies for Office.
|
|
|
|
|
Hello,
I have 3 classes for example :
public MainClass
{
private int maximum = 100;
private int minimum = 0;
private int valueC = 50;
[Browsable(true)]
public int Maximum
{
get {return maximum ;}
set {maximum =value;}
}
[Browsable(true)]
public int Minimum
{
get {return minimum ;}
set {minimum =value;}
}
[Browsable(true)]
public int ValueC
{
get {return valueC ;}
set {valueC=value;}
}
public MainClass()
{
}
}
public ElementsClass
{
private PropertiesClass elementsProperties;
[Browsable(true)]
public PropertiesClass ElementsProperties
{
get {return elementsProperties;}
set {elementsProperties =value;}
}
public ElementClass()
{
}
}
public PropertiesClass
{
private bool visible = true;
private Color colorC = Color.Black;
private bool blink = true;
[Browsable(true)]
public bool Visible
{
get {return visible;}
set {visible =value;}
}
[Browsable(true)]
public Color ColorC
{
get {return colorC;}
set {colorC=value;}
}
[Browsable(true)]
public bool Blink
{
get {return blink;}
set {blink=value;}
}
public PropertiesClass()
{
}
}
In the MainClass i want to include a ElementClass property but i must be able to have an ElementClass array or collection and each ElementClass has the 3 PropertiesClass properties.
What i don't know how to do is the next:
I want to show the MainClass properties in a PropertyGrid, the ElementsClass data must open a new window like a collection editor showing a list of all the ElementsClass objects that i have created.
Finally when i select some element in the list, the propertyGrid must show the PropertiesClass properties (visible, colorC, blink).
Can somebody help me with this?
Regards,
Alberto Martinez
|
|
|
|
|
First you could have searched for collection editor[^] here on CodeProject. That gives you several links.
Here[^] and here[^] are two good articles which deal especially with this topic.
|
|
|
|
|
I'm trying to optimize some code that I've written and I've come across a style that I use ~20 or times that will be run ~100 or so times during the full execution of my code(a VSTO excel spreadsheet).
Here's the common syntax
If (complicated boolean statement)
{
form.attribute = true;
}
else
{
form.attribute = false;
}
I was wondering whether using something like this would make any difference
form.attribute = complicated boolean statement.
Could eliminating the if/else actually noticably speed up my code, or is this change so insignificant that I shoul concentrate on some of the other pieces of code to eliminate database calls and recomputation when it isn't necessary?
|
|
|
|