|
I have Form1 and call a thread. How to set the value of an edit box in Form1 from the thread(class DownloadThread). Thanks.
public class Form1 : System.Windows.Forms.Form
{
private void btnGO_Click(object sender, System.EventArgs e)
{
DownloadThread dwThread=new DownloadThread(str,1);
Thread thread=new Thread(new ThreadStart(dwThread.GetStream));
thread.Start();
}
}
public class DownloadThread
{
public void GetStream(string str,int dLevel)
{
}
public void GetStream()
{
}
}
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
Pass an instance of the edit box to your download thread class. Also keep in mind you cannot modify a Windows Forms control like and edit box from a thread other than the GUI thread. Use Control.Invoke or Control.BeginInvoke to marshal a call back to the original thread.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: He has a funny face. And he's my son.
Judah Himango
|
|
|
|
|
Hello, i'm using a dataGrid in my application to load in data from an access database. The data is loading in fine and all, i'm just looking for a means of having each column resize automatically to fit it all in on the screen. For example i have a details column that when normally viewed you can't see all the details until double clicking the column divider at the top to resize it to fit the data.
I'm just after a means of getting it to automatically resize rather than having the user need to double click the column divider to have it resize.
Thanks In Advance,
Bryce.
|
|
|
|
|
Only Microsoft knows why this little feature was ommited from the 1.0 and 1.1 Framework DatGrids, but here[^] is an aritcle on MSDN that demonstrates how to do it. It's in VB.NET, so it shouldn't be too hard to convert the code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I am trying to run an .exe application using RunAs. I don't know how can RunAs handle the exception of the exe application I want to run.
Can you guys give me a hint?
Thanks so much.
|
|
|
|
|
|
Could you please be more detailed?
Where should i search?
Thanks
|
|
|
|
|
Hi,
I am developing a C# application, that has display the list of classes, methods and properties from a .jar file and .class file (created in java). How to accomplish this?
Thanks and Regards.
|
|
|
|
|
AFAIR, Jars are compressed archives in a standard format (ZIP, I think), which contain a manifest.
You should be able to use most open archiving libraries (but check on the format first).
Cheers
Sid
|
|
|
|
|
This is the actual exception/stack trace:
An unhandled exception occured in the program
The type initializer for "RDC.Global" threw an exception.
The root element is missing.
The exception was thrown by System.String get_DataLocation()
at RDC.Global.get_DataLocation()
at RDC.FileManager.get_Location()
at RDC.Album.ReadXml(String albumName)
at RDC.DetailsAlbum.set_AlbumName(String value)
at RDC.DetailsPane.InitializeComponent()
at RDC.DetailsPane..ctor()
at RDC.MainForm.InitializeComponent()
at RDC.MainForm..ctor()
at RDC.MainForm.Run()
at RDC.MainForm.Main()
the property looks like this:
return Environment.GetFolderPath( Environment.SpecialFolder.Desktop );
and it's only happening on one notebook, but I really want to figure out why. Putting that code into a new program, and running it so it comes up in a messagebox, gives a messagebox with the path to the desktop ( on that particular notebook ).
Furhter, this is the calling code in FileManager.get_Location
Logging.Log("Getting Location");
string link = Path.Combine( Global.DataLocation, Consts.LocalPhotoFolder );
Then the property looks like this:
public static string DataLocation
{
get
{
Logging.Log("Getting Data Location");
try
{
string retval = Environment.GetFolderPath( Environment.SpecialFolder.Desktop );
Logging.Log("Returning " + retval);
return retval;
}
catch (Exception e)
{
Logging.ForceLog("Environment.GetFolderPath failed");
Logging.ForceLog(e.Message);
Logging.ForceLog(@"returning c:\ as default");
return @"c:\";
}
}
}
Here's the kicker - my error log contains "Getting location" - it does NOT contain "Getting Data Location". So the error seems to be trying to find the property to access it.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Try using "DesktopDirectory" instead of "Desktop", i.e., try using the following code and see if it solves your problem:
return Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
|
|
|
|
|
I've got a question: Is you Log file being opened, written, flushed, and closed every time you write to it? If not, you're could be losing at least one line at the bottom of the log.
Environment.SpecialFolder.Desktop returns the virtual folder, which might not exist on that notebook. This could be because of some rights issue or a COM screw up for the Desktop.
I hate to say to it , but the first thing I'd do is garantee that your getting the physical path to the current desktop folder with
SpecialFolder.DesktopDirectory. <br />
<br />
It looks like <code>Global.DataLocation and/or Consts.LocalPhotoFolder didn't return what you thought they should. You might want to add a little code to debug those return values.
Logging.Log("Getting Location");
Logging.Log(" GDL=" + Global.DataLocation);
Logging.Log(" LPF=" + Consts.LocalPhotoFolder);
string link = Path.Combine( Global.DataLocation, Consts.LocalPhotoFolder );
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
I've got a question: Is you Log file being opened, written, flushed, and closed every time you write to it? If not, you're could be losing at least one line at the bottom of the log.
I have a helper function to make sure that a flush occurs every time, but a close does not occur every time, no. Surely flush is all I need ?
Dave Kreskowiak wrote:
Environment.SpecialFolder.Desktop returns the virtual folder, which might not exist on that notebook. This could be because of some rights issue or a COM screw up for the Desktop.
Thanks, I got that and tried DesktopLocation, it still crashes.
Dave Kreskowiak wrote:
but the first thing I'd do is garantee that your getting the physical path to the current desktop folder with SpecialFolder.DesktopDirectory.
Wrote a little app that does exactly that, it works fine on the notebook, brings up the path in a message box.
Dave Kreskowiak wrote:
It looks like Global.DataLocation and/or Consts.LocalPhotoFolder didn't return what you thought they should.
I logged Consts.LocalPhotoFolder, it's a const string anyhow, it was what I expected. Global.DataLocation does not appear to ever be entered. I think it's a problem with initialisation of a static object.
Dave Kreskowiak wrote:
Logging.Log(" GDL=" + Global.DataLocation);Logging.Log(" LPF=" + Consts.LocalPhotoFolder);
LOL - did exactly that yesterday, but the other way around ( as I expected the DataLocation to be the problem ). Got the localphotofolder, and then the usual crash. The thing is, all of the Global.DataLocation property is now in it's own try/catch, which doesn't rethrow, and logs something completely different. The try/catch is never entered, the exception is thrown by attempting to access the property, not within it.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Can anyone point me to a good way to draw a usercontrol inside a listbox over and over again? What I mean is to insert something like a panel (with stuff on it obviously) inside a listBox and have that be displayed instead of some random strings (I've tried inserting it and I get random strings...I honestly don't remember what though). I REALLY don't wanna have to draw everything with GDI+ so if anyone knows a way to do that, I would appreciate it greatly. Note: It can also be a listview - either will do fine. I haven't found anything on CP that shows how to do that, so if there is something, please point me there. and forgive my stupidity.
|
|
|
|
|
Mmm cool idea, a ListBox for controls.
Off the top of my head, you'd create the controls say, Panel s, as children of the ListBox , and depending on the scrolling, move the controls that should be visible to somewhere inside the visible area of the ListBox .
You'd have to write some code for the scrolling, and managing of the controls, but you can let them paint themselves.
And don't forget to write an article for CP once you're done.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I've got a program with a function that contains this line of code:
return Environment.GetFolderPath( Environment.SpecialFolder.Desktop );
that's the whole function. It's fine on my machine, but blowing up on the client, with an error about a root node being missing. Does anyone have any ideas ? He reckons it crashes on multiple machines. I have a try catch around the main function, that writes the call stack and error message to a log file.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Try using "DesktopDirectory" instead of "Desktop", i.e., try using the following code and see if it solves your problem:
return Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
|
|
|
|
|
Thanks, but I've discovered the error occurs in the boundary between one class and another ( see above) .How does the change you suggest differ from what I've done ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
"Desktop" is the logical Desktop rather than the physical file system location.
On the other hand, "DesktopDirectory" is the the directory used to physically store file objects on the desktop.
Therefore, one should not confuse this directory with the desktop folder itself, which is a virtual folder.
|
|
|
|
|
Thanks - that's a worthwhile change, although it stands no chance of fixing the problem at hand ( as far as I can see ). Live and learn...
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi folks,
I need to write a piece of code to list all the virtual directories in IIS.
Could you guys give me a hint?
Thanks
|
|
|
|
|
|
Please excuse if this not the place to post this.
I update from VS2002 to VS2003, I my computer all is fine with all. But in the user machines I have this exception:
<br />
System.TypeInitializationException: The type initializer for "SIFEX_Administracion.modDeclaraFormas" threw an exception. ---> System.IO.FileNotFoundException: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found.<br />
<br />
File name: "CrystalDecisions.CrystalReports.Engine"<br />
at SIFEX_Administracion.modDeclaraFormas..cctor()<br />
<br />
=== Pre-bind state information ===<br />
LOG: DisplayName = CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304<br />
(Fully-specified)<br />
LOG: Appbase = C:\Archivos de programa\Grupo Acón\SIFEX\Bin\<br />
LOG: Initial PrivatePath = NULL<br />
Calling assembly : SIFEX_Administracion, Version=1.0.3.8, Culture=neutral, PublicKeyToken=null.<br />
===<br />
I hvae instaled net framewokk 1.1 in users machines and copy Microsoft Visual Studio .NET 2003/Crystal Desitions folder of my cumputer to the user computers and the problems still apear?
How can I solve this problem?
Thank you!
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
How does one use the Data Access Object pattern using serialization or if your objects are in a hierarchy?
|
|
|
|
|
Is there a way to get the exact size of a process ? I've been looking at the Process class' members that deal with memory (PrivateMemorySize, PagedMemorySize, etc...) but none of them give me the same number as Task Manager does. Anyone know how to get the exact size of a running process ? Thanks in advance...
-Pete
|
|
|
|