|
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
|
|
|
|
|
How i can connect with mysql database on the server through PDA using C#
wasim khan
|
|
|
|
|
Well.. I'm using a library you can download it from mysql website it's called:
MySql Connector Net.
It works pretty good for me and it imitates the ADO.NET structure, but I don't know
whether there's something special for PDAs.
Here is the link:
http://dev.mysql.com/downloads/connector/net/5.2.html[^]
I'm using version 5.0 and it works fine. You can try the other versions but I know nothing about them.
Hope it was useful.
|
|
|
|
|
k Thanx blackangelss
let me explore it
wasim khan
|
|
|
|
|
Hi,
if we check the parent node of the treeview then all the child node should be checked & also when we uncheck the parent node then it should uncheck the child node.code for web Application.
|
|
|
|
|
string data = GetYourQuestion();
if (!CheckQuestionIsRelatedInThisForum(data)){
throw new WrongForumException("GET OUT OF HERE...");
}
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
HTML Part
<input type="button" name="CheckAll" value="Check All" onclick="checkAll(document.myform.list)">
<input type="button" name="UnCheckAll" value="Uncheck All" onclick="uncheckAll(document.myform.list)">
|
|
|
|
|
Wrong forum. Do not post a javascript question in the C# forum
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
You just posted this a few posts down... please dont do that, else no-one will want to answer you.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Hi,
I am using ref parameters to return values...
What is wrong with this code please?
private void SecurityTypesValidity(ref string strFirst, ref string strSecond,
ref string strThird)
{
//some processing to assign the above parameters i.e:
//...
strFirst = "valid";
strSecond = "Indeed";
strThird = "super";
}
string strFirst = "";
string strSecond = "";
string strThird = "";
//error on this line ???????
SecurityTypesValidity(strFirst, strSecond, strThird);
//????
The error above is 'Argument 2 must be passed with ref keyword'
|
|
|
|
|
arkiboys wrote: SecurityTypesValidity(strFirst, strSecond, strThird);
SecurityTypesValidity(ref strFirst, ref strSecond, ref strThird);
hope it helps
dhaim
ing ngarso sung tulodho, ing madyo mangun karso, tut wuri handayani. "Ki Hajar Dewantoro"
in the front line gave a lead, in the middle line build goodwill, in the behind give power support
|
|
|
|
|
Corrected and solved.
Thanks
|
|
|
|
|
The error message states clearly what you should do.
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]
|
|
|
|
|
Hi there
I think everybody know about OnScreen Keyboard[^] from MS Windows(type osk in run).
I wish to make that kind of application using C# but i have the following questions:
1) Those buttons are customs controls?
2) How to have just one function which triggers the pressed keys?
modified on Thursday, October 30, 2008 5:50 AM
|
|
|
|