|
I did not find it there
Thank you for your answer
Edit: Or is there another way of checking whether right to left text will display correctly on my form?
modified on Thursday, October 30, 2008 11:29 AM
|
|
|
|
|
Hello everyone,
Suppose an exe is linked (referenced) with a couple of DLLs, and both the exe and the DLLs have their own app.config file. My question is, when we call API to load application configuration values, are there any confusion about which config to be loaded since both exe and DLL have app.config files?
thanks in advance,
George
|
|
|
|
|
There is only one config file associated with current AppDomain.
|
|
|
|
|
Thanks Giorgi,
But from IDE, we can add one app.config for DLL and another app.config for application, suppose the application loads the DLL into one application domain, then there should be two app.config?
regards,
George
|
|
|
|
|
If the application loads dll in its appdomain then the dll will read from its own config file. On the other hand, if the dll is in the same domain as executable, then the dll will read applications config file.
|
|
|
|
|
Thanks Giorgi,
You claimed one application domain could only have one application configuration file, do you have any related document mentions this?
regards,
George
|
|
|
|
|
|
Thanks Giorgi!
It take me time to read them all and have some try. I think the final conclusion should be DLL can not have its own config file and must use the exe's application configuration file, correct?
regards,
George
|
|
|
|
|
.DLL's don't get their own app.config. They are code extensions loaded into the process of the .EXE using them, and hence, use the .EXE's app.config.
|
|
|
|
|
Thanks Dave,
But from IDE, Add --> New Item --> we can add a new application configuration for a DLL... Any comments?
regards,
George
|
|
|
|
|
Yeah, you can also add other stuff to the project that you don't use either, like .BMP files, text files, yada, yada, yada. Just becuase you can add it, doesn't mean that it gets used.
|
|
|
|
|
Hi Dave,
You mean Visual Studio is designing a useless feature to allow DLL to add app.config?
regards,
George
|
|
|
|
|
|
Hi, all.
I'm working with threading and I need to now if thread can return an answer, boolean or string and, if yes, how I do that.
Thanks a lot.
|
|
|
|
|
Yes, it can. Search Google for "Synchronizing with main thread".
Enjoy
|
|
|
|
|
|
Hi,
I have a few forms in my project and I am opening them one after another like this:
Password Entry Form
Save File Dialog
A selection form with a few buttons on it to select output display.
-These 3 windows do not have a parent form and they are not related to each other.
-They are not displayed at the same time. As I said I open them in the given order, one after the previous form is closed.
-I open all of them using ShowDialog() method.
My problem is:
I have tried many settings but the last form keeps opening in background and does not have focus. So the user cannot see the window at top.
I have tried setting TopMost property, but the result is the same.
I am trying to set all these forms to be displayed at top when they are opened.
I think I have a problem in understanding the behavior of Windows while handling these Modal dialogs.
Can anyone suggest me a link to learn this behavior or an example that may lead to solution of my problem?
Thank you,
Always keep the Murphy Rules in mind!
|
|
|
|
|
I am wondering if there is a way (perhaps through Attributes) that I can indicate to a PropertyGrid that I want a certain Property (which is an int) of a class MyClass to be limited to a given range, say 0-10. I know I could put Runtime checking into the Property's set method itself and throw an error if the new value is out of range, but I don't want to throw an error, I just want the PropertyGrid itself to limit the valid range to be 0-10.
Use ICustomTypeDescriptor, PropertyDescriptor and an Attribute.
Create your own Attribute, like RangeAttribute that stores the min and the max. The only thing you have to validate is that the objects that are passed in support ICompareable. It's handy to put in a method in this class to check if a value is within range IsInRange( object val ).
Next create a PropertyDescriptor that takes another PropertyDescriptor as a constructor parameter. In the SetValue method look for the RangeAttribute, call IsInRange(). If it's in range, perform the set (on the PropertyDescriptor that was passed in) if not dont.
Third create a base class (or implement it in all of the classes that you want) that forwards most calls to TypeDescriptor. The only method that you need to implement is GetProperties( Attribute[] ). Basically what you want to do is get a list of all the properties from the reflected class, and create a new PropertyDescriptorCollection with your PropertyDescriptors.
Then you will be able to specify properties like this.
private int _Foo;
[MyRangeAttribute( (int) 0, (int) 10 )]
public int Foo
{
get
{
return _Foo;
}
set
{
if ( value != _Foo )
{
_Foo = value;
}
}
|
|
|
|
|
netJP12L wrote: Can somebody translate this and tell me what it means
Translate it? To what language? Listen up pal, the fact that you can't understand what people say because you refuse to read the documentation is your problem not ours. Nobody can pry your head open and pour knowledge into it. You will have to do the reading and the studying to try and understand things you need to do your job.
led mike
|
|
|
|
|
netJP12L wrote: I am wondering if there is a way (perhaps through Attributes) that I can indicate to a PropertyGrid that I want a certain Property (which is an int) of a class MyClass to be limited to a given range, say 0-10.
The PropertyGrid doesn't do that. Validation code should be in the property's setter, not in the Grid. The only way you could possibly do this is to implement your own UITypeEditor[^]. Again, this is NOT recommended just to limit the range of a value.
|
|
|
|
|
I have UserControls in MDI child forms containing TextBoxes and other controls.
When user re-activates form, I need that Control which was last activated is activated again.
Currently *first* control is activated always.
To reproduce:
1. Run code.
2. Make TextBox2 as current TextBox by selecting its text
3. Activate other form
4. Activate previous form by clicking in form title bar
Observed:
TextBox1 receives focus
Expected:
TextBox2 should receive focus
How to force UserControl to forward focus to child its current child control (TextBox2) ?
using System.Windows.Forms;<br />
public class Test<br />
{<br />
static void Main()<br />
{<br />
Application.Run(new MainForm());<br />
}<br />
}<br />
<br />
class MainForm : Form<br />
{<br />
public MainForm()<br />
{<br />
WindowState = FormWindowState.Maximized;<br />
IsMdiContainer = true;<br />
Form frm = new Childform();<br />
frm.MdiParent = this;<br />
frm.Show();<br />
Form frm2 = new Childform();<br />
frm2.MdiParent = this;<br />
frm2.Show();<br />
frm2.Left = 2000;<br />
}<br />
}<br />
<br />
class Childform : Form<br />
{<br />
public Childform()<br />
{<br />
Controls.Add(new Mycontrols());<br />
}<br />
}<br />
<br />
class Mycontrols : UserControl<br />
{<br />
public Mycontrols()<br />
{<br />
TextBox tb1 = new TextBox();<br />
tb1.Text = "TextBox1";<br />
TextBox tb2 = new TextBox();<br />
Controls.Add(tb1);<br />
tb2.Top = 100;<br />
tb2.Text = "TextBox2";<br />
tb2.Select();<br />
Controls.Add(tb2);<br />
}<br />
}
Andrus
|
|
|
|
|
Hi, Can anyone tell me why the error is coming like "Cannot implicitly convert type 'System.DateTime' to 'string'"?
When i work with the following code.
Code:
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now;
Label2.Text = DateTime.Now;
Label3.Text = DateTime.Now;
}
Thanks in advance.
|
|
|
|
|
Because DateTime.Now is of type DateTime...
Try
Label1.Text = DateTime.Now.ToString();
or custom format
Label1.Text = DateTime.Now.ToString("yyyy-MM-dd"); //etc...
|
|
|
|
|
Well, the error message is clear...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Everyone gets bogged down in the beginning with small things like t hat
|
|
|
|