|
hiii every body i have an apllication that consiste of a main form which have a main menu from which i open forms using (ShowDialog) every time i open the form and close it a new object created and the old one still in memory i noticed that using memory profiler i dispose the form and set it to null but it is still in memory this is because the form is still refrenced by a threadstart object which is refrenced by a thread object which i have create inside the form but it has finished i don't know why it is still refrence the form
please anybody know how can overcome this problem
dfds
|
|
|
|
|
Have you been disposing the dialog form once your done with it?
Form2 testDialog = new Form2();
testDialog.ShowDialog(this);
testDialog.Dispose();
If you don't .Dispose() the dialog, you'll keep creating instances that are never cleaned up. Read the docs[^] on Form.ShowDialog() for more information on how this method works.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi guys,
In VB the representation for hexedecimal is &H1 . How do you write this in C# . Please help. i'm running out of time.
|
|
|
|
|
Hi!
Like C/C++, C# uses '0x' as prefix for hex numbers, for example 16 = 0x10.
mav
|
|
|
|
|
Cheers guys,
I have a little problem here:
With my Service, I know I need to complete OnStart() within a few secs, so in order to make this a server, I have to spawn a new thread.
Problem is: I "have been encouraged" to "prefer the object-oriented approach", e.g. create an object of my "Server-Class" and then let it do the work.
Apparently, I cannot do this (well, I failed miserably).
I never had to do Multi-Threading with objects. Well, I need to find a way to either spawn a new thread running myServer.StartListening() manually OR to have .NET do this for me.
Using a thread pool, csc complains that CListenServer.StartListening does not match the WaitCallback-Delegate. It obviously wants a static method (which I am "encouraged" not to use).
The only other way of doing this is "new Thread (new ThreadStart(CListenServer.StartListening)", which obviously also requires a static method.
If I simply call "StartListening" in "OnStart()", I will block the OnStart()-Method and the service wont run.
Any tipps?
Cheers
Sid
|
|
|
|
|
hey,
try this, i hope i did understand it right (my english is worse . Otherwise ignore this reply
Thread ServerThread = new Thread(new ThreadStart(AsynchronousSocketListener.StartListening));
ServerThread.Start();
and have a look at this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreadingthreadclassctortopic.asp
Dumby
|
|
|
|
|
Hi,
I have a smal problem, but needs immediate resolution.
I have an MDI application through which i opens a form; say "Form1".
From "Form1" I am calling another form; say "Form2".
Now, when clicking a button in "Form2", I need the focus to be given back to the original "Form1".ie, I need "Form1" to be activated.
Somebody please help me in doing this.....
Thanks
Sapna
|
|
|
|
|
In form2, u put the following code within the button click event
Response.Redirect("form1 with extension");
Try it
|
|
|
|
|
codes/w wrote:
Response.Redirect("form1 with extension");
Which I am sure this works for a web application, but for a System.Windows.Forms application, try
void Form2_button1_click(object sender, eventargs e)
{
Form1.Focus();
}
Be aware that if you have opened the Dialog modally (i.e. from form1 you called form2.ShowDialog()) then the focus will stay in Form2.
|
|
|
|
|
|
I have a very simple and easy to use solution for you
simply pass the parent form as a parameter in the constructor of the second one (I think that any window (especialy MDI) has a parent property thow) and when you desire call myParentForm.Activate();
(or more professional (but recomandede in a try\catch)
this.Parent.Activate();
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
call the forms parent activate procedure
this.Parent.Activate()
or give the second form an argument (the main form)
<br />
class Form2 {<br />
Form1 myParentForm;<br />
...<br />
Form2 (Form1 parent) {<br />
...<br />
myParentForm = parent;<br />
...<br />
}<br />
...<br />
this.myParentForm.Activate();<br />
...<br />
}<br />
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Actually I need Drill Down Crystal Reports.
Ex : 10 Mater Recodes are there.
TEST 1
TEST 2 liket that.
If I click TEST1,It should display another report TEST1 Details.Help me Please!
|
|
|
|
|
U can go for SubReport "On-Demand" Option.
Give the details in subreport. Insert subreport in main report and give the name as TEST1
All the best
|
|
|
|
|
Hi!Dear,
I released my c# project usbtest(Cs) and got the usbtest(Cs).exe.There is no problem when I run it on my own WinXP PC,but when I run it on other's WinXP PC or Win2000 PC,then error occurs:
Win2000:error name:usbtest(Cs).exe--cannot find DLL
error content:can not find DLL mscoree.dll in the appointed path. F:\;.;C:\WINNT\System32; C:\WINNT\system; C:\WINNT;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem
WinXP: error name:usbtest(Cs).exe--application error
error content:application normal initialization (0xc0000135) fail.Please click "OK" to terminate application.
Can you tell what makes this error and how to work out it?
Thanks!
momer
|
|
|
|
|
Hello,
The .NET application must be installed to run a .NET application. mscoree.dll is a DLL that is installed as a part of the .NET framework installation. You cannot redistribute this DLL yourself, it must be installed with the .NET framework installer.
|
|
|
|
|
hi,Brian Nottingham,
Thank you very much!
But what my problem is not the .net itself I think. The vs.net can run on my PC without any trouble. the truble is my program can only run on my own PC(WinXP) where I develop it.when I run it on other PC(WinXP or Win2000) the error occurs.
If you like,I can email you my c# program usbtest(Cs).
Thank you again!
momer
|
|
|
|
|
Right, thats what I am saying. If you have VS.NET installed on your computer, then you have the .NET Framework installed, and thus your program works. If the other PC's do not have VS.NET installed, or the .NET Framework installed, then your program would not work.
|
|
|
|
|
Hi,Brian,
So,Do we have to ask our customs to install .NET Framework before use our application developed by C#.NET?
what if the application developed by VC.net?
And the .NET Framework package 1.1 is 23.5MB,is it necessary to force our customs to install the whole package? Maybe there is one or more alternative way to solve this problem.
momer
|
|
|
|
|
Hi,Brian,
So,Do we have to ask our customs to install .NET Framework before use our application developed by C#.NET?
what if the application developed by VC.net?
And the .NET Framework package 1.1 is 23.5MB,is it necessary to force our customs to install the whole package? Maybe there is one or more alternative way to solve this problem.
momer
|
|
|
|
|
Yes, your customers would have to install the .NET Framework before using any application developed in a .NET language. The .NET Framework is not required for C++\MFC, but it is however required if you use MC++.
|
|
|
|
|
Your customer MUST install the .NET Framework (the same version you developed your app under) in order to run your application.
If you app was written using C++/MFC, without using any managed extension, then you can get away with deploying your app without the .NET Framework. But, if your app was coded in Managed C++, then your customers will have to install the Framework in order to use your app.
There are projects out there that will strip down the .NET Framework and install only those components requires by your application, but this is NOT a recommended practice. It makes the Framework lighter in terms of disk space, but if your custom were to try and install a Service Pack for the .NET Framework, it won't work. Also, if you run into problems and must consult Microsoft on the issue, the FIRST thing they'll tell you to do is install the ENTIRE .NET Framework.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi all,
(1)i've got 24 columns in my Ms access database. After selecting a row, i need to extract each of this value and store them in an array. Currently, i'm using this method which is kinda long:
foreach (DataTable getTable in graph_ds.Tables )
{
foreach (DataRow getRow in getTable.Rows )
{
//extract the values from the 24 columns
string a = getRow["col1"].ToString();
string b = getRow["col2"].ToString();
string c = getRow["col3"].ToString();
string d = getRow["col4"].ToString();
string e = getRow["col5"].ToString();
..........
string x = getRow["col24"].ToString();
..........
//store them in an array
float [] b = new float[24];
b[0]= float.Parse(a);
b[1]=float.Parse(b);
b[2]=float.Parse(c);
b[3]=float.Parse(d);
..........
b[23]=float.Parse(x);
}
}
Is there any other shorter method.?
(2)i've got 24 column in my database. after i've selected a row based on a certain condition, how do i get the biggest value in this 24 column?
Chris
|
|
|
|
|
why not just throw in another loop there so you dont have to repetitively read each of the 24 columns? Somthing like this:
<br />
<br />
foreach(DataTable dt in myDataSet.Tables)<br />
{<br />
int colCount = dt.Columns.Count;<br />
foreach(DataRow dr in dt.Rows)<br />
{<br />
float [] b = new float[colCount]<br />
for(int i=0;i<colCount;i++)<br />
{ <br />
string colName = String.Format("col{0}",i+1);<br />
b[i] = float.Parse(dr[colName].ToString);<br />
}<br />
<br />
}<br />
}<br />
|
|
|
|
|
I made up a bigger and explicit answer but i wasn't logged on so here is the short version :P :
(1)use the following loooop
<br />
for(int i = 0 ; i < 24; i++) {<br />
b[i] = Convert.ToFloat(getRow["col" + i + 1]);<br />
}<br />
(2)use a sort routine on the vector (actualy a get max value search the whole vector and store the biggest value)
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|