|
I get some strange behavior from a comboBox.
It selects it's value, when the tab page where it's on is Entered.
I do not want that to happen!
When creating or layouting the selection is NULL.
(I'm using the tabpages from the magiclibrary by the way, the designer f***s the visualAppearance enum up but it work ok)
The comboBox uses a dataView for it's selectedValue
and an other one for it's dataSource.
Tried setting the SelectedText in the SelectedValueChanged event but it's already NULL.
Solved it by setting the selectedtext in the tappage enter function.
Unfortunatly this means that i have to litter my code all over the place with functions that fix this.
Is there a more generic sollution to this?
Could I inherit and catch some hidden event that get's fired just before it get's shown? (but after it's layouted)
Or does sombody know what setting might be wrong?
Still puzzling..
(PS 4 people have been trying to find it for a few days now and no luck, so probably only the true wizards can solve this riddle.)
|
|
|
|
|
I'm also having some problems with a ComboBox.
The documentation defines the SelectedText property:
A string that represents the currently selected text in the combo box. If DropDownStyle is set to ComboBoxStyle.DropDownList, the return is an empty string ("").
The default value for DropDownStyle is DropDown, not DropDownList.
For my application the ComboBox has a DataView as its DataSource. After selecting an item from the drop-down list, the SelectedIndex and SelectedValue properties contain the expected values. The SelectedText property contains an empty string even though the correct value is clearly displayed in the edit window.
I haven't tried this yet, but I think setting the SelectedIndex to "-1" will cause the edit window to remain empty until a value is selected.
>>>-----> MikeO
|
|
|
|
|
I'm working on a windows app that uses a PropertyGrid control. The grid displays certain properties of some objects that I use in my app. I want to make the PropertyGrid display a dialog for a string property. This functionality is typically available for properties of array type. I want the user to be able to click next to the string property and make a dialog popup so that he/she can construct the value of the string property from some possible options. Is this possible?
|
|
|
|
|
See the UITypeEditor class. You need to derive the class and create your own UITypeEditor that uses GetService to request the IWindowsFormsEditorService so that you can call ShowDialog and pass an instance of your form. Finally, use the EditorAttribute on your property that specifies the Type (or the type string if in another assembly for design-time only that you don't want to ship, which should be installed into the Global Assembly Cache (GAC)). There should be examples of this in the documentation for these classes in the .NET Framework SDK.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
10x a lot! This worked perfectly!
|
|
|
|
|
Hi friends:
i had such question: i wrote my code in vs.net then i press f5 to view the result of my program,but theres only a flash of the commandline window which disapeared within 0.5 second... Is there any method to view the result while coding with vs.net? I have known the method that write such code as Console.ReadLine() at the end of the code . Is there any other method ?
thanks for your help
|
|
|
|
|
You can either Debug the code, manually run it from the command line, or put in a Thread.Sleep(x) where X is the number of Milisecoinds you want the program (current thread) to pause for. If you use the Thread.Sleep option, you will need to reference the System.Threading library.
|
|
|
|
|
I do the same. I use
#if DEBUG
Console.ReadLine()
#endif
So that it only does it in debug builds, and release builds work normally.
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
|
|
|
|
|
This is because your main method is finished.
At the ned of your program put
while(true);
But you will have to close the project manually
|
|
|
|
|
I create a console application project for Multicast of IP. I get a problem when I run this application.
The console outputs an error message: Invalid Parametres. I implement multicast with an UDPClient object like this:
ip=IPAddress.Parse("234.5.6.7");
UdpClient s = new UdpClient();
s.JoinMulticastGroup(ip); //The exception happens here
//Environment: Windows Server 2003 Standard Edition, VC#.NET
Thanks
|
|
|
|
|
Make sure you set the AddressFamily of the UdpClient in the constructor before calling JoinMulticastGroup , otherwise an ArgumentException will be thrown. This constructor overload is only supported in .NET 1.1 and higher. More information about the exception that is thrown and the version of the .NET Framework in which you're developing might help if this doesn't solve your problem / is not possible to implement (i.e., using .NET 1.0).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi.
Is there any way to center-align columnheaders in a datagrid while the text in the rows of the column is still rigth-aligned?
I found out using datagridTextBox.Alignment, but this aligns both header AND text in the rows...
any help?
|
|
|
|
|
You could create your own DataGridColumnStyle derivatives and ignore the Alignment property. Just derive from the existing ones like DataGridTextBoxColumn and DataGridBoolColumn to avoid having to implement the rest of the behavior.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
but the columnstyke also aligns both the text and the headers, right?
So unless i override the paint event, I can't do what i want....
|
|
|
|
|
In the override for DataGridColumnStyle.Alignment , try returning HorizontalAlignment.Left . The default painting procedure should use that to paint the text; otherwise, yes, you will have to do the text painting yourself (but that is pretty easy to do). See Graphics.MeasureString and Graphics.DrawString for more information.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
hi!
i try to connect three tables by two datarelations. the first two are no problems but the third one doesnt work. i tried to connect table a with table b and table b with table c. connection b to c is the connection that does not work
Andreas Fähndrich
|
|
|
|
|
You are talking very general. What do you mean by does not work and what is your code that does not work?
Mazy
No sig. available now.
|
|
|
|
|
sorry for that. here the problem more detailed:
I have three datatables in one dataset. this construct shall save datastrings for many kinds of databases. i want to connect thee three tables in that way:
Tablenames: Databases, Connectionstrings, Parameter
one database can have several connectionstrings, one connectionstring can have several parameters.
i connected the tables that way:
//CODE:-------------------------------------------------------
System.Data.DataColumn dc2 = ds.Tables["Datenbanken"].Columns["id"];
System.Data.DataColumn dc4 = ds.Tables["ConnectionStrings"].Columns["db"];
DataRelation dbcs = new DataRelation("dbcs", dc2, dc4); //dbcs = Database --> Connectionstring
ds.Relations.Add(dbcs);
System.Data.DataColumn dc3 = ds.Tables["ConnectionStrings"].Columns["id"];
System.Data.DataColumn dc1 = ds.Tables["Parameter"].Columns["cs"];
DataRelation cspm = new DataRelation("cspm", dc3, dc1); //cspm = ConnectionString --> Parameter
ds.Relations.Add(cspm);
dataGrid1.DataSource = ds;
dataGrid1.DataMember = "Datenbanken";
dataGrid2.DataSource = ds;
dataGrid2.DataMember = "Datenbanken.dbcs";
dataGrid3.DataSource = ds;
dataGrid3.DataMember = "ConnectionStrings.cspm";
//END OF CODE----------------------------------------
"id" is always the primary key
the relation "cspm" does not work
better?
mfg
|
|
|
|
|
What exactly doesn't work? Is the third grid just not showing any rows?
One other thing you could try, although your code looks correct, is to design a strongly-typed DataSet (add a new item to your project and select DataSet in the popup window) and create the tables and relationships in there. You can also drag-n-drop from the Server Explorer for a database connection as well. When you fill the DataSet using a DbDataAdapter derivative, you don't have to worry about all the code for the relationships and what not.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
the connectionstring-table shows the right rows according to the database-table. if i click the database-table, the connectionstring-table reacts and shows the right rows. when i click on the connectionstring-table, the parameter-table should react and show the right rows according to the connectionstring-table. but it doesnt. it only shows the rows that are right to the first at the beginning. it doesnt reat to any click in another datagrid.
|
|
|
|
|
The first question that comes to mind then is if there is actually related data for the second table's rows. I'm figuring there is, but it has to be asked.
One other thing you could try is to "disconnect" the first relationship and just make sure that the 2->3 table relationship is working correctly.
I seem to remember a similar thread about this problem a long time ago. You could try searching the comments (click "Search Comments") above) to see what was the solution, if any. I suppose it's possible that such a relationship isn't possible, though I would think this is an unlikely possibility.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
the connectionstring-table shows the right rows according to the database-table. if i click the database-table, the connectionstring-table reacts and shows the right rows. when i click on the connectionstring-table, the parameter-table should react and show the right rows according to the connectionstring-table. but it doesnt. it only shows the rows that are right to the first at the beginning. it doesnt reat to any click in another datagrid.
|
|
|
|
|
Hi
How do I determine if my application is currently active? I.e. I want to see if my app. is the one in focus or if the user has shifted to another app. by clicking it's box in the taskbar, etc.
Thanks for your help,
Mads
|
|
|
|
|
You can overriden Leave event for when it lost focus. Also for regulary check it ,you can check Focused property of form in a timer.
Mazy
No sig. available now.
|
|
|
|
|
Thanks for your reply.
Unfortunately, Leave doesn't seem to have the requested effect. The Leave event is not raised when the active application is changed, I think we will try to do a work around using MDI.
|
|
|
|