Now I have two questions here.
I am using the graphics object to create a customized report from a database. To ensure WYSIWIG, I use the same functions in the paint event of the panel with the printPage event of a PrintDocument after passing the necessary event arguments.
So far there is no trouble. Printing and previewing works just the way I want.
(NB - Did not use the printPreviewControl as I felt it was way slower than a panel. Don't know if I am right.)
So, Am I going the right way to create a WYSIWIG compliant application?
I want to save the created report into a XML format. I used the XMLWriter class, and was almost succesful in saving the report. I was ready to pat myself in the back and call it a day when it occured that I knew no way to serialize a Brush object. All I want to store is just the brush color. How can I get the color of a brush object? Because I don't see any properties exposed. Any workarounds?
As for the brush, figure out the type (likely a solid brush), cast it to that type, and serialize the properties you want.
e.g. (for a solid brush)
// brush is declared as Brush brush, but is a solid brush instanceif(brush is SolidBrush)
SolidBrush sb = (SolidBrush)brush;
// Serialize the properties of the brush here
elseif(brush is LinearGradientBrush)
// And so on and so forth.
// Repeat for other brush types as required
hi i am trying to read NTFS share permission. Imported
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]<br/>
protected struct SHARE_INFO_2<br/>
public string NetName;<br/>
public ShareType ShareType;<br/>
public string Remark;<br/>
public int Permissions;<br/>
public int MaxUsers;<br/>
public int CurrentUsers;<br/>
public string Path;<br/>
public string Password;<br/>
Hey folks!! Hope you can help me with my client code.
Först I debugg the Server wich is an consoleapplication and the server starts, secondly I debugg the Client, I put a nickname value to the nickNameTextBox and click on Connect (button2) the compiler stops at this code line
from the button 2 handler - unless you have pressed Button1 first, the connection has not been established and it will likely throw an exception - probably the one you are complaining about.
Personally, I would have a "Connect" method, which checked if you are connected and does so if not - and call it from both click events. (I would probably also make it return the stream instead of using a class level variable directly in the two event handlers).
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
Thank you mate I appreciate your help, I changed it to this code,
the reason I commented out
because the compiler stops there when I debugg telling me that a socket is already connected, now the compiler runs withour errors but the server consoleAppplication doesn't receive any msg at all when I send it from sendTextBox..
privatevoid button1_Click(object sender, EventArgs e)
if (serverStream == null)
MessageBox.Show("Please connect to a server.");
readData = "Conected to Chat Server ...";
serverStream = clientSocket.GetStream();
byte outStream = System.Text.Encoding.ASCII.GetBytes(sendTextBox.Text + "$");
serverStream.Write(outStream, 0, outStream.Length);
Thread ctThread = new Thread(getMessage);
The compiler stops on this code under the getMessage method
"Failed to read data from the transport connection: An existing connection was forced to close by the remote host." It havens because I closed the Server... Anyway this project is driving me crazy man I can't see why it's not working and the Server doesn't get and show the string on the server prompt from the Client
In a C# 2010 desktop application, I need to add an audit table to an application that would be similar to the 'main' table. Basically whenever anyting is changed in the 'main' table I need to show the corresponding change in the 'audit' table. The 'audit' table will be a mirror copy of the 'main' table. The only difference is one table is called 'main' table and the other table is called the 'audit' table.
**Note these table reside in a sql server 2008 r2 database.
Would you setup a trigger? If so, can you show me the sql you would use?
Would you write C#.net 2010 code? If so, can you show me the code that would solve my problem?
Let's say you have a table containing customer orders. An order has an ID, a status, and a number of other things including creation date and user. As the order is processed, the status will change and you want to be able to report each status change.
Rather than having one row and overwriting the previous values, you can create a new row with the new values.
In this way you can easily see the details of an order's life all in one table. When a new state is created, the only change you make to the previous state is to set the NextID field. And the current record is the one with NextID==null.
I need to create a desktop application using C# as frontend and postgresql/postgis for the database.
I have google maps V3 embedded into web browser control.
My question is, is there any way to visualize geometry column of postgis into google maps using C#.
You get Access Denied because the account your code is running under does not have permissions to the remote machine. By default, if you don't specify any account information in the Management connection objects, it'll use the account your code is running under. If that account doesn't have permissions on the remote machine, it'll fail.
I have a form with a progressBar on it. I'm doing writes in another class (through my interface) and need to show my progress of doing the writes, but I'm getting an error message *. Hopefully someone has an idea how to get the error to go away and so I can update my progressBar from a different class.
I'm more of a C++ developer doing C#, so there might be something that an experienced C# person would know of that I'm missing.
It looks like this:
Form with progressBar displayed
privateint writeIt(ref byte wDat, byte sDat)
result = cr.ProcessTWriting(ref wDat, ref pb_Progress.Value); //this passes a ref to the progressBar value
* In the code above, I'm getting "A property, indexer or dynamic member access may not be passed as an out or ref parameter" error message.
My interface looks like this:
iCR.cs (which is in another VS project due to future CR6, etc. which will use the interface)
int ProcessTWriting(ref byte wDat, refint pb_value);
Then, I want to pass my references (to progressBar value) to where I'm writing my bytes (i to 1024), and update the reference to the progressBar as it iterates through, writing to it's destination.
This would be in my CR5.cs which implements iCR.cs (and is in another VS project still...think Factory pattern):
Sorry in advance for my english. Possibly is not good enough yet...
Do you have the possibility to change your interface?
I'm thinking that a solution to your problem could be the use of events on your CR5 class. (Observer pattern)
You could create an event on CR5 class that can be subscribed by the class that contains the progress bar. Then, you can fire your event on the AttempWrite function with a parameter that indicates de current progress value to set into the progress bar.
Is it a possibility? Or are you constrained to this interface contract?
That's a good idea. I'll give that a try. I can absolutely change my interface. That's why I'm showing the progressBar value in the interface now. I'm not absolutely sure how to send a value when I fire an event, but I'll take a look. Thanks!