|
Well, again not in C#.. If you have some C++ backgrounds, you can look up CMemFile class in your MSDN. Maybe it helps.
Regards
|
|
|
|
|
Using code DOM there is the ability to create an application on the fly essentially. Don't know if it would apply to your situation
only two letters away from being an asset
|
|
|
|
|
hi,
i need to swap between forms, im looking at 3 screens on (yes realy screens attached to pc)
on each screen there is a different form, but in a menu i can choose diffent forms to look at, only the 3 most always remain the same,
so if i swap from form on the first screen it needs to close the form that was there befor and check if its not the form form screen 3,
realy a bit fussy....
i found a example but its in vs 2003:
http://www.codeproject.com/csharp/applicationcontextdemo.asp[^]
and i'm not sure how to implement this in my existing application.
any body has tips??
thx
|
|
|
|
|
faladrim wrote: (yes realy screens attached to pc)
I have 5
So you have several different forms in your app and you want to change which one has the focus ? Or you have several different apps running ?
If Marc's 2003 code does what you want, it will work in 2005 as well.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thx,
it's more like a perant child thing,
i have one app with several forms
one is a visualisation of a factory, this is the one that always should stay
and in a menu bar you can choose several others like:
logs, history, orders, alarms, .... these are changeble on the two other screens
i think for this i should work with parent child not?
the perant is the form with the menu bar, and all the others are the childern
you think this shoud work?
ill know it monday :p
-->> its weekend
|
|
|
|
|
Hello,
I have to made some application in which I'm using MDI forms. Like in first form I have two buttons say button1 and button2, from here I've to navigate to a MDI parent form and in it the child window regarding the respective button clicked should open. I'm struck here as i dont know how to perdorm this action.
Can someone help me please...
And yes Please give code rather than simple suggestion
Thx n regards
PARAG
|
|
|
|
|
Hello
I don't really think I get you!! Do you mean you want to activate a second MDIchild when a button on the First MDIChild is clicked?
Regards
|
|
|
|
|
Ok take an example
I have an initial form a Login form
on this form I have labels and text boxes for loginid and Password, and tqo buttons Login(for existing user) and Signup(if new user)
now there is an MDI window FORM now if the Login button is clicked then user must enter his home page form in the MDI window FORM, and if SignUp is clicked then SignUp form must open in the same MDI window FORM..........
That is what i want
I hope its clear now
|
|
|
|
|
Why do you want it MDI?? For all I know it's a simple form with a webbrowser control in a Dock.Fill state. The login in dialog is just another form. In your Form_Load event just write
MyLoginForm login = new MyLoginForm();
if(login.ShowDialog() != DialogResult.Cancel)
{
if(login.IsSignUo)
webBrowser1.Navigate(SignUpURL);
else
webBrowser.Navigate(HomePage);
}
Regards
|
|
|
|
|
Hi
I use a picturebox and filled with a bitmap onto the form.Now if i place any control it display a control color in background.How can i make it transparent only text displayed not control color
Parshant
|
|
|
|
|
You need to use SetStyle to allow transparent background, and set the background color to Transparent. At least, that's what the docs say. It doesn't work for me. If I want transparent, I write an owner drawn control.
How does this relate to your picturebox ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
but if i make background color to transparent it does't work
|
|
|
|
|
Like I said, it doesn't work for me either. But that's what the docs say. I've had to resort to writing my own derived controls and owner drawing them, making sure I set double buffering and all painting in WMpaint, so the control does not erase itself.
But why do you have a picturebox ? If it's for a background, your form has a BackgroundImage property.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am in the process of designing a web-querying application requiring quite a few seperate thread processes to run when I click the "Run" button...
I tried using Threadpool and although it works reasonably well (though I dont have a basis for comparison and think that it can be much faster - run more threads - actually), there's a major flaw with it: I cannot destroy threads midway through operation (using "Stop" button).
I came across the BackGroundworker here: http://msdn2.microsoft.com/en-us/library/waw3xexc.aspx[^] but I am not sure whether multiple Background workers is a good idea.
Also came across a custom-designed thread pool here: http://www.codeproject.com/cs/threads/workqueuethreading.asp[^] which seems quite promising.
Any ideas which of the above 2 options could be more suitable? Any other advice on threads will be taken aboard with much appreciation.
Many thanks,
Gerry
Threading-newbie
|
|
|
|
|
Hello
1- Make a new thread
2- Make a List<Thread> collection
3- Add the new thread to the list
4- Loop until you reach the number of threads that you want
5-
foreach(Thread T in MyThreadCollection()
T.Start();
6- When you want to stop aprubtly call T.Abort() in another foreach loop.
Regards
|
|
|
|
|
Thanks this seems like a good way to create a 'Thread Pool'...
I have a little problem tho - the construct for a thread is as follows:
<br />
Thread t = new Thread(new ThreadStart(ThreadProc));<br />
but I'd like to add an "array" of threads to MyThreadCollection, each associated with a string
fetched from a richtextBox of variable length:
<br />
<br />
for (int j = 0; j < InList.Length; j++)
{<br />
Thread |ThreadName?| = new Thread(new ThreadStart(ThreadProc));<br />
MyThreadCollection.Add( |ThreadName?| );<br />
}<br />
<br />
foreach(Thread T in MyThreadCollection() <br />
T.Start();<br />
<br />
ie. what should I put for |ThreadName?| above? Is there some way of using a string array to assign each element as the "name" of a variable? Also, is it possible to pass an argument to the ThreadProc method?
Your help mcuh appreciated!!
gerry
|
|
|
|
|
gvanto wrote:Is there some way of using a string array to assign each element as the "name" of a variable?
Well, instead of using a generic List, use
Dictionary<string, Thread> MyThreadsCollection = new Dictionary<string, Thread>();
MyThreadsCollection.Add(ThreadName, MyThread);
Where the ThreadName is the text you get from the RichTextbox.
To get the Thread with the specific name use
MyThreadsCollection[ThreadName] = new Thread(new ThreadProc);//for example
gvanto wrote: Also, is it possible to pass an argument to the ThreadProc method?
Use ParameterizedThreadStart delegate instead of ThreadStart.
Regards
|
|
|
|
|
Wow thanks Nader,
Your methods are excellent and have been VERY helpful thanks a million!!
I'm actually doing it like this:
<br />
<br />
for (int j = 0; j < InList.Length; j++)<br />
{<br />
AddThread(InList[j]); <br />
} <br />
<br />
private void AddThread(string threadName)<br />
{<br />
ThreadStart threadDelegate = new ThreadStart(ThreadProc);<br />
Thread t = new Thread(threadDelegate);<br />
t.Name = threadName;<br />
<br />
this.MyThreadList.Add(t);<br />
}<br />
But Im not sure - it seems to work but is it healthy?
Thanks for the advice on ParameterizedThreadStart - will check it out immediately!
Gerry
|
|
|
|
|
You are welcome .
I believe that you still use a Generic List to add threads? Giving a thread a name in a list is possible but has to disadvantages:
1- You have to iterate through all the list to get a certain thread with a name
2- Unlike a Dictionary , you can add 2 threads with the same name, which could be confusing and very error brone.
That's why I recommended a dictionary<string, Thread> to take care of all these validations for you.
gvanto wrote: it seems to work but is it healthy?
You mean the list? That's what I said above, but if you mean something else, what is it, and what makes you think it's unhealthy?
Regards
|
|
|
|
|
Hi Nader,
ACtually, as it happens I dont really need to reference the threads by name, but rather I do it by their index number:
MyThreadList[i].Start(); etc...
But I'm taking all your ideas on board as I am sure in the very near future I will hit a dead-end and will require more flexibility (as usual!) But so far the use of this threading (instead of ThreadPool) has been great - seems to be faster and I can actually kill threads midway through as required.
Thanks again Nader, I'll be on this thread again soon I am sure!
Until then!
Gerry
|
|
|
|
|
Hi Nader,
ACtually, as it happens I dont really need to reference the threads by name, but rather I do it by their index number:
MyThreadList[i].Start(); etc...
But I'm taking all your ideas on board as I am sure in the very near future I will hit a dead-end and will require more flexibility (as usual!) But so far the use of this threading (instead of ThreadPool) has been great - seems to be faster and I can actually kill threads midway through as required.
Thanks again Nader, I'll be on this thread again soon I am sure!
Until then!
Gerry
CrazyWebmaster
|
|
|
|
|
hi
i am use .Net 2.0 (VS2005)
i want to add Key to my app.cong and give it value but i don't know how to do this . somebody say me
use this code :
using System.Configuration; //add ref to System.Configuration.dll
//-------------------------------------
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add("Color", "Red");
config.Save(ConfigurationSaveMode.Full);
but i doesn't found Configuration,ConfigurationManager in System.Configuration Namespace .. please help me how to solve my problem and save application seeting in app.cong and retrive it later.
thanks
|
|
|
|
|
try to add key and value in following way
ConfigurationSettings.AppSettings.Add(keyname,value);
rahul
|
|
|
|
|
OK .. I was done your suggestion but the Following error shown me :
The configuration is read only.
and my other problem is that : Where does ConfigurationManager and how to use it ? (ConfigurationManager does not exist in my project solution or System.Configuration Namespace)
i am using .net 2.0 .
thanks .
|
|
|
|
|