|
If you want a better message box, create one. With the MessageBox in the FCL, what you see is what you get. This P/Invokes the native MessageBoxEx API, which is also limited.
Just build a Form derivative with a lot of the same functionality, perhaps exposing a public property for setting icons or stick the with single, overloaded method like MessageBox.Show where you can provide a custom icon. The Form derivative should be smart enough to resize itself when need and to allow for the customization of Button s based on what's needed, as well as where to place them. It's really not as hard as it might sound, though, and many developers including myself have done this from time to time to provide a more feature-rich dialog.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hiii...alll
i 'd like to send data files and text between clients ,,,with no servers in between(No Ftp Server).....
Also I wanna to know the connection between clients
Thanks,,,all
|
|
|
|
|
kano zangeef wrote:
i 'd like to send data files and text between clients ,,,with no servers in between
This is a little vague. Can you be more specific?
I assume you mean outside of a LAN situation. And I am also assuming you don't want your existing windows to act as FTP servers either (which could have been an option as it is built into Windows). Further, I am assuming that you want the files to be transferred both ways - In other words Computer A can send files to and request files from Computer B, and also Computer B can send files to and request files from Computer A.
kano zangeef wrote:
Also I wanna to know the connection between clients
Sorry, I don't understand this. Do you mean what technology do you need to use in order to achieve your goal? Or what?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
I think he means something like P2P networks without a central server. The Gnutella protocol is one example.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
If you want to create a P2P network, you need to either define and implement the protocol yourself, implement an existing protocol, or use an existing protocol along with an existing library. Windows XP SP1 introduced a new P2P library that I know someone here was working on wrapping.
If you don't need an entire P2P network of clients and just want to communicate between two distinct clients, then you just need to use simple socket communications or .NET Remoting (a much more powerful technology using ubiquitous protocols like HTTP and SOAP).
For more information on .NET Remoting, see Accessing Objects in Other Application Domains using .NET Remoting[^], as well as http://www.ingorammer.com[^]. Pick up a good book, too. With power (extensibility) comes complixity.
For simple socket communications, see the System.Net.Sockets[^] namespace in the .NET Framework SDK, specifically the Socket class (for low-level comms), or the Tcp* and Udp* classes. Note that using this mechanism you're still left with defining at least a simple protocol whereby clients agree to so that they can communicate correctly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How do I open a Collection Editor for a property in code? I know how to open if via the property editor. I want to force it open via code. Obviously it's doable, because VS.NET is doing it in the property editor.
Any ideas?
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
Jamie Nordmeyer wrote:
Obviously it's doable, because VS.NET is doing it in the property editor
I think that is part of the Visual Studio IDE and not part of the .NET Framework.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Add the Editor attribute to the property, and set it to the type: System.ComponentModel.Design.CollectionEditor
I have a symbiotic relationship with my computer.
|
|
|
|
|
He's asking how you open it, not attribute your collection class/property with one.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
VS.NET provides an implementation of the IWindowsFormsEditorService that UITypeEditor s like the various collection editors use. It's not a simple question of just showing the form.
First, call TypeDescriptor.GetEditor with either the object or Type for which you want to get the collection editor. Cast that to a UITypeEditor . If not null , call UITypeEditor.EditValue passing an implementation of the IServiceProvider - which you must implement - along with the collection to edit.
In your implementation for the IServiceProvider , you must return an instance (could be the same instance) when the IWindowsFormsEditorService is requested, which you would also need to implement. This is what the specific UITypeEditor uses to display its collection editor form.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath. That did the trick!
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
Does anyone have a code in c# for an application for a ticket agency that sells tickets in 3 auditoriums. The program should allow for the sell of specific available seats in the various price and location categories for the specific theater layout and performance and should be graphically displayable.
Thank You
|
|
|
|
|
This sounds like a homework question. You should attempt this yourself. However if you have any specific problems then you're more likely to get help.
BTW, no I've never done this sort of application, but is doesn't seem too difficult.
Do you have your data model sorted out yet?
Do you have your object model sorted out yet?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
hi all,
i ran into thi sproblem this monday and still havent been able to figure out why the list view control is not showing the complete text string.
the original strings i want to be displayed in the list view are more than 350 chars long, but it only displays 259 chars of each string. BUT when i extract the string values from the control it DOES give me complete strings. i have tried to increase the column width but nothing happens.
Can anyone Please help me with this as soon as possible.
THANX in advance.
COde is as below.
#####################################################
public void FillListView()
{
int len = 0;
for (int i=0; i<dl.totalrecords; i++)
{
="" listviewitem="" li;
="" li="new" listviewitem();
="" li.text="DL.array_view[i].ToString();
" console.writeline("li="" value="" is="" :="" "="" +="" li.text.tostring());
="" length="" li.text.length.tostring());
="" li.forecolor="System.Drawing.Color.Green;
" if="" (dl.array_view[i].length=""> len)
{
len = DL.array_view[i].Length;
}
li.EnsureVisible();
listView1.Items.Add(li);
}
Console.WriteLine("max length is : " + len.ToString());
listView1.Columns.Add("", 20000, HorizontalAlignment.Left);
listView1.BackColor = System.Drawing.Color.Beige;
}
|
|
|
|
|
Hello,
I am using SystemParametersInfo from user32.dll to change the background on WinXP.
Now, whenever I change the background, the mouse moves from whatever its current position is to a spot near the bottom left corner of the screen. I could just save the cursors position before changing the background and move it back to its original position immediately after the background is changed, but is there a way to prevent it from moving in the first place? Does it have anything to do with SystemParametersInfo?
When I change the background thru windows by right-clicking on desktop and going to properties, the mouse gets moved to the center of the screen after the change.
Is this behaviour unavoidable?
Thanx for the help
-Flack
|
|
|
|
|
Hey,
I am having a problem with an application which uses ADO.NET..
Here is the situation:
My application is composed of 2 forms : Form1 and Form2,
1- Form1 contains the Main method, and creates a new Form2()..
Form1()<br />
{<br />
...<br />
void SomeMethod(..)<br />
{<br />
Form2 f = new Form2(.., connectionObj, transactionObject..)<br />
f.Show();<br />
}<br />
...<br />
}
2- In Form2, I open the connection and start a TRANSACTION, like this:
...<br />
connectionObj.Open();<br />
transactionObj= conn.BeginTransaction();<br />
...<br />
this.Hide();
I don't commit the transaction in Form2, because I have to wait for another insertion request in Form1
3- When I move to Form1, I try to insert a new line in a certain table, with an SqlCommand, which I try to affect to the transaction, but it doesn't work, I get an error message.. It seems that the modifiation set to the transactionObj are not taken into consideration inside Form1, knowing that it was first declared in this form...
Any help please?!
|
|
|
|
|
Even after SqlConnection.BeginTransaction() , you have to set the SqlCommand.Transaction with the object returned by the former call.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yes I do that everytime before I execute (.ExecuteNonQuery()) any command..the problem is when I return to Form1 (Remember that the transaction is set to a valuer in Form2), I create a new SqlCommand and I write :
sqlcommandObj.Transaction = transactionObj;
But I always get an error here :
sqlcommandObj.ExecuteNonQuery();
|
|
|
|
|
It would be helpful if you told us what the exception type and message were, perhaps even a stack trace. Would you just tell a doctor that you have a pain without specifying where?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
for logging purposes, I need to be able to determine the thread ID of the currently executing thread.
I've discovered that I can pretty easily get the thread ID from the ProcessThread class. What I can't figure out is how to determine which ProcessThread corresponds to System.Threading.Thread.CurrentThread.
Any tips on how to get the ID that I'm looking for?
BTW, I've already tried using Thread.CurrentThread.GetHashCode(). While it seems to work (unique numbers), a comparison to the ProcessThread IDs in the app makes it perfectly clear that there's no direct correlation.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
I used the following two:
System.Diagnositics.ProcessThread Id Property
AppDomain.GetCurrentThreadId()
The former is OS Thread ( so Process)
The latter is CLR Thread ( so AppDomain)
Is that what you are look for ? Any other ways ??
James
|
|
|
|
|
Thanks, James. The AppDomain is what I was looking for.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
|
|
|
|
|
Is this possible? I've done it successfully many times on Controls and UserControls, but I'm having a tough time getting them to show up on a form. For example:
[Designer(typeof(MBen.Windows.Forms.Wizard.Design.WizardDesigner))]
public class Wizard : System.Windows.Forms.Form
{
...
}
</pre/
Here's the designer:
<pre>
public class WizardDesigner : System.Windows.Forms.Design.ControlDesigner
{
private DesignerVerb[] m_Verbs;
public WizardDesigner()
{
System.Diagnostics.Debug.WriteLine("Inited");
m_Verbs = new DesignerVerb[1];
m_Verbs[0] = new DesignerVerb("Add/Remove Pages", new EventHandler(OnAddRemovePages));
}
public override DesignerVerbCollection Verbs
{
get
{
System.Diagnostics.Debug.WriteLine("Doh");
return new DesignerVerbCollection(m_Verbs);
}
}
protected void OnAddRemovePages(object sender, EventArgs e)
{
MessageBox.Show("Clicked");
}
}
When I right-mouse click on my form, no verbs have been added.
Any ideas?
Thanks in advance.
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
Got it.
[Designer(typeof(MBen.Windows.Forms.Wizard.Design.WizardDesigner))]
public class Wizard : System.Windows.Forms.Form
should be
[Designer(typeof(MBen.Windows.Forms.Wizard.Design.WizardDesigner), typeof(IRootDesigner))]
public class Wizard : System.Windows.Forms.Form
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
Hi,
Is there any painless way to marshal an object [] into a ptr?
I'm writing a plugin wrapper and the object [] is a paramarray ['params'] that represents a structure in the plugin. I was wondering if there was an easy way to do this, similar to the Marshal.StructureToPtr() maybe ..
Here's an example for clearification ..
The wrapper's function:
<br />
void MyPluginFunction (params object [] data)<br />
{<br />
ptr = MarshalObjToPtr(data);<br />
PluginFunction(ptr);<br />
}<br />
The plugin function to be called (written in C# for this example)
<br />
void PluginFunction (IntPtr ptr)<br />
{<br />
myData = (MyStruct)Marshal.PtrToStructure(ptr);<br />
...<br />
}<br />
Now 'myData' now holds all info in ptr, but in MyStruct representation.
NOTE: The plugin may not be written in C#,
and that is why I would need is to be marshalled.
Using the wrapper would be as simple as:
<br />
MyPluginFunction(12, 8, "hello");<br />
The above would map to the plugin's structure:
<br />
private struct MyStruct<br />
{<br />
int a, b;<br />
string s;<br />
}<br />
Thus allowing the above function's 'myData' to be as follows:
myData.a = 12, myData.b = 8, myData.s = "hello"
Or if there's an easier way to do this, that could work too.
Best regards,
- Joe
|
|
|
|
|