|
hi, thanks i managed to do it. but i got another problem.. i'v e got this class.. this is the function
<br />
class test<br />
{<br />
public void test ( string LD )<br />
{ <br />
LD = "haha";<br />
}<br />
}
<br />
class Form1:System.Windows.Forms.Form<br />
{<br />
private void btnConvert_Click(object sender, System.EventArgs e)<br />
{<br />
string date;<br />
cL.CalendarConversion(date);
}<br />
<br />
}
<br />
i can't pass the value of LD from class test to date from class Form1.. why?<br />
Chris
|
|
|
|
|
class test
{
public string test ( string LD )
{
LD = "haha";
}
} // end of class test
class Form1:System.Windows.Forms.Form
{
private void btnConvert_Click(object sender, System.EventArgs e)
{
string date;
test ts = new test();
date = ts.test();
cL.CalendarConversion(date); // date is not null now
}
}//end of class form1
Is this that u wanted?
Ketty
|
|
|
|
|
I have a Form that contains a progress bar. While the form has focus, it works fine, but as soon as it loses focus the progress bar stops working and the form doesn't work until the process is completed. I've tried refreshing the form and the control to no avail. Thanks for any help. My next step is to try to multithread it.
|
|
|
|
|
mrlou88 wrote:
and the form doesn't work until the process is completed
Which process do you mean?
www.troschuetz.de
|
|
|
|
|
Try adding a call to Application.DoEvents() inside your loop.
Regards,
Alvaro
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. - George W. Bush
|
|
|
|
|
I would suggest using Delegate and Events to update the status bar based on the events in the process.
Cheers!
<bold>Looney Tunezez
"If you build it....
.....BUGS will come!" -JB
Application.Run(new Form1(this.Dispose())); <--WHAT :wtf::confused::eek:
"Stability. What an interesting concept" - Chris Maunder
<bold>
|
|
|
|
|
i created a control which has a collection of an object which is not control.when i add an object to this collection during design time no code is added to my code page ,i want to know whether controls can be added from designer to a collection or i miss something..?
|
|
|
|
|
It is very difficult to determine what is your problem and what it is you are asking! But I will try to give you an answer.
If you have a control on a form that also has a collection of items (such as a ListBox) you can either add objects at design time or at development time. These, however, are not controls!
Controls (naturally) are added to forms at design time and you can add additional controls at runtime. You can also access the controls you added at design time.
Some controls (like infragistics) also have controls that have control collections. Again, you can add them at design time as well as at development time.
Access of the controls, what control to add, how to access and control them, is dependant solely upon the control itself.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
mmmmmm...
you know my control uses a colection objects that they are control,during design time i can add,remove and so on and i can see the effects but no extra code is written for them by designer and when i run my project its clear that i loose my collection .i want to know if i have to add some code to my control or collection to force the designer to apply codes to the project itself...
thanks...
|
|
|
|
|
Ah, now the clarity rises!
If you have it ATTRIBUTEd as a collection and it binds successfully with the CollectionEditor (the elipse opens the window to Add and Remove objects from the collection) then it should add the objects for you...in the designer.
However, you also will have to generate the required output so that the source code represents those objects. You should be creating the definitions for each individual object as well as the adding to the control collection in the InitializeComponent() section. So that is going to require hooking into the Changed event so that you can handle those changes in the source. This include removing any objects pulled out of the collection.
You will also probably have to do some reverse population, so that when the editor is closed/reopened you can gather your definitions/properties from the source code so that the designer properly represents the populated collection.
So you would have to generate:
...
MyNamespace.MyItemType {object namein collection};
...
private void InitializeComponents()
{
...
set any properties here that the user changed in the collection editor
MyNamspace.MyControl {theirname} = new MyNamspace.MyControl();
{theirname}.Items.Add({object namein collection});
Good Luck.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
you are right ...
although my collectioneditor works but it does not add any code ...
you say "you also will have to generate the required output so that the source code represents those objects" and my problem is here that when i'm using collectioneditor how i can generate the output?
thanks
|
|
|
|
|
There are one of two approaches you can take.
1- you need to know that an add/delete/change has occured within the collection. So you could write your own CollectionEditor which inherits from the ComponentModel.CollectionEditor (I think it is located there)
You need to check your methods available for override. I believe there is a method that the propertygrid calls into to validate a change. You need to intercept that call, identify the operation (add/change/del) then write out (or delete) the source code.
2- the other approach is to write your entire CollectionEditor yourself. Not a pretty sight.
Once you do that you need to overcome problem #2. How to gain access (addressability) to the current source document. I cannot help you there. You may have to do some searching on MSDN or try posting a question to GotDotNet and hope a developer sees your post.
I spent a year and a half in the bowls of PropertyGrid objects. Very complex stuff --- but boy do you get a hell of alot of power out of it. I am now known by my developers as the Voodoo Doctor because of the loosly bound objects that appear to easily flow together.
The problem you face is that the editors run in a vaccuum without too much knowledge of their environment unless it is available via Static methods. You may even have to delve into VSIP(?) which is the program/packages for accessing Visual Studio from Microsoft. I suspect you won't get far accessing a C# module without it!
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Build a quick app using the menu item. Add some menues to it and edit via property grid. Then look at your source and at your InitializeComponents() method. Make several changes and see how they propogate into the source. That is what you must accomplish.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Hi ,
Thanks for your reply,my basic idea is calling everything from command prompt without showing windows or hiding windows,clearly what i want i have to pass username and password... from command prompt like this,
windowsApp1 -U userName -P password -S serverName -F fieldname(which is in database),after that every thing will have run as a background without showing windows.if possible send o/p to console.
i think its clear now,if you have any samples send me
thanks.
|
|
|
|
|
Why don't you just run it mininmized and set the form show in taskbar property to false. That makes it run invisibly.
|
|
|
|
|
Hi ,
Thanks for your reply,my basic idea is calling everything from command prompt without showing windows or hiding windows,clearly what i want i have to pass username and password... from command prompt like this,
windowsApp1 -U userName -P password -S serverName -F fieldname(which is in database),
after that every thing will have run as a background without showing windows
i thinkits clear now,if you have any samples send me
thanks.
|
|
|
|
|
Hi
Could anyone please explain to me why the following results in two mdi forms but the textbox only appearing on the second one? Clearly there is some sort of mechanism preventing me from hosting the same control on two different forms but I can't find any documentation regarding this.
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
this.IsMdiContainer = true;<br />
<br />
TextBox box = new TextBox();<br />
<br />
Form frmchild=new Form();<br />
frmchild.MdiParent=this;<br />
frmchild.Controls.Add(box);<br />
frmchild.Show();<br />
<br />
Form frmchild2=new Form();<br />
frmchild2.MdiParent=this;<br />
frmchild2.Controls.Add(box);<br />
frmchild2.Show();<br />
<br />
}<br />
Thanks in advance!
Ewan.
|
|
|
|
|
Try this:
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.IsMdiContainer = true;
TextBox boxA = new TextBox();<br />
TextBox boxB = new TextBox();
Form frmchild=new Form();
frmchild.MdiParent=this;
frmchild.Controls.Add(boxA);
frmchild.Show();
Form frmchild2=new Form();
frmchild2.MdiParent=this;
frmchild2.Controls.Add(boxB);
frmchild2.Show();
}
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
No - i think you've missed the point of my original post. I know perfectly well I could do ask you suggest but that wasn't my question.
|
|
|
|
|
I answered your question with code. You need separate instances of the textbox -- one for each form. So yes, I answered your question.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
I think your trying to add the same instance of a TextBox control to two different forms at the same time?
This will not work because of threading, concurrency, message pump, and window handle issues. You MUST use two different instances of the control. Think about it. How is a dual-hosted, single instance control going to fire events in one window and not the other?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to read the properties of a MS Word file (like author, comments...) and I found two solutions:
- by starting a word application class
- by using the system32.dll
The problem with the first solution is that it uses a lot of ressources and takes quiet a bit of time (you actually open up the whole MS Word Software only to get some properties).
The problem with the second solution is that it doesnt work on Win2k or lower. It only works with WinXP or higher. The system32.dll of Win2k or below only gets the file size and creation dates and other properties but none of all those other MS Word specific properties.
So can anyone give me a hint how to get those properties on Win2k without opening a word application?
Thanks for any hints!
Bertram Weckmann
|
|
|
|
|
When is size assignment is done for the first time is done to a control?
|
|
|
|
|
at the form constructor in InitComponents() ,the windows designer handwork
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Look in the "Windows Form Designer Generated Code" Region. You'll find all the properties, that are not default values, of your controls are set in there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|