|
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.
|
|
|
|
|
I need to get a Java application to communicate with a C# apps. What're the possible ways of doing that? References/Url would be nice. Just want to add that I'm new to Java, and been coding Windows code for the most part of my life. So, please keep in simple and treat me tender.
Thanks in advance.
Norman Fung
|
|
|
|
|
Depends what you want to communicate but XML would be a good way if you want to do it file/db based. Another would be some sort of Socket based communication not sure how it would go between C# and Java.
Just a little idea
HTH
Luke
|
|
|
|
|
IPC, Java and C#: Is it possible to do this via shared memory...?
Thanks.
Norman Fung
|
|
|
|
|
If you want to actually host .NET controls in a Java application see my article, Embedding .NET Controls in Java[^]. There are also commercial libraries available such as JAWIN and Ja.NET that generate the necessary classes at runtime.
As far as interoperability between Java and .NET at the communications layer, there has been a whole slew of articles on MSDN[^], such as Application Interoperability: Microsoft .NET and J2EE[^].
As for one of your other questions, I suppose you could use IPC but you're going to spend a lot of time just P/Invoking the necessary functions, creating any structs, etc. The articles I mentioned should provide alternatives that can possibly decrease development time and - in some cases - use standard protocols to communicate between the two.
-----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-----
|
|
|
|
|
Hey that's very useful tips. I'll look at it.
Norman Fung
|
|
|
|