|
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
|
|
|
|
|
How can I create a borderless menu or a transparent menu when creating a owner drawn menu? I have seen this in the Winamp 3x.
UB
You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++
|
|
|
|
|
To make a menu transparent, you can use Menu.Handle to get an HWND for the popup window that represents that menu and use the native function SetLayeredWindowAttributes (you'll have to P/Invoke it). To draw the menu without a border, you'll have to handle the MenuItem.DrawItem event and do all the drawing yourself.
You can find several examples here on CodeProject using a search like menu draw[^] or similar. Dr. Gui on MSDN[^] also had a good example some time back at http://msdn.microsoft.com/library/en-us/dnaskdr/html/askgui11062001.asp[^]. The example's in VB.NET but it's mostly method calls (remember, the base class library - or any assembly for that matter - is available to all languages that target the CLR, or ".NET languages", in the same way; though, the syntax for making those calls may be different).
-----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-----
|
|
|
|
|
Thanks for the advice. I found several articles on CodeProject. To make it borderless they have used subclassing. It's a war out there. Some of them have used hooks, and some of them are against using hooks
By the way I went to geekcode.com, and now I know what's that first three letters mean
Thanks again.
UB
You may stop this individual, but you can't stop us all... after all, we're all alike. +++Mentor+++
|
|
|
|
|
Can anyone help as I am having a little trouble..
I have a panel with AutoScroll = True. I have added a panel to this control which is bigger than the parent, so scroll bars appear. Then I add another panel calculating the position using
<br />
panelPos = PanelList.Count * APanel.Height;<br />
APanel.Location = new System.Drawing.Point(30, 38 + panelPos);<br />
When the scroll box is not scrolled adding panels puts each one directly below the next as I want. But if the parent is scrolled down then the position is wrong (the new panel is added too low down) by an offset.
I thought the answer would be in the AutoScrollPosition property but I haven't been succesful in making it work.
Any ideas?
TIA
Luke
|
|
|
|