|
Have a look here[^].
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
This was exactly what I wanted (and even more - my program creates a thumbnail picture now!)!
Thanks a lot Polis!
|
|
|
|
|
Ur welcome
Glad I could help
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
hi
i need to round off an integer to the nearest 100
probably a very simple solution but its wreckin me head
any takers?
Tanx
Katie
|
|
|
|
|
That's not rounded - it's truncated!
-----------------------------
Get trial copy of comment generating tool CommentMakerPro, a collection of convenience and productivity tools for Microsoft Visual Studio .NET FeinStuff, and std::string and std::string containers viewer FeinEvaluatorPro at www.FeinSoftware.com
|
|
|
|
|
System.Math.Round(The number of the digits it will be to the nearset to );.
|
|
|
|
|
I'm trying to write a toolbar using this tutorial:
"http://www.codeproject.com/csharp/dotnetbandobjects.asp"
by the tutorial I am trying to sign the assembly with a strong name using this line:
[assembly: AssemblyKeyFile(@"..\..\..\BandObjects.snk")]
but I keep on getting the error:
duplicate 'AssemblyKeyFile' attribute.
I tried to continue without that line and using only regasm without the gacutil (because of a post someone added in board of this tutorial),
but of course it doesn't work...
can anyone help me with this ???
Thanks!
|
|
|
|
|
Hi - any help with this would be greatly appreicated - it has already had me
confused for a good few hours!
I am using Visual Studio 2003 and the .NET framework 1.1.
I have a C# Windows Service, with my own class extending from ServiceBase in
the normal fashion. The service starts a remoting object (WKO and
singleton) which many clients can then make calls on. Clients may also
register with events on the server such that the server will inform clients
when certain actions occur.
This all works fine and clients are appropriately notified when the server
fires the events.
However, I would like the clients to also be informed when the service is
stopping - and so I thought that firing an event in the service's overridden
OnStop() function would be ideal for this. I can see that the multicast
delegate on the server has the delegates to call upon so it seems the
clients have successfully registered their interest in the service shutting
down. I can prove this by firing the event at any time and all works well.
However, the strange behaviour I am seeing is that as soon as I break on
entry to the OnStop() method - the place where I need to fire the event -
the event/delegate member variable is null - someone (not me!) has clearer
all the delegates - so it appears that no one is interested in the service
shutting down - when there really are interested parties.
Does anybody know why this is happening? The service has member member
variables - some value types, some reference types, and they are all still
present and correct on entry to the OnStop() function, but any event member
variables have been cleared and are nulls.
Is this possibly as designed for some reason and Ive missed some piece of
documentation saying that events are cleared by the time the framework calls
OnStop for you?
Any help greatly appreciated.
Thanks,
Dan
|
|
|
|
|
I am using a textbox that has such fields as "name, address, phone numbers, and dates". I would like to format the phone numbers as '(999) 000-0000' and the dates as '01/01/1111'. I have tried several things that do not work. The sample by "Oscar Bowyer" is very complex I would like something very simple, is there anything? I need help!!!!!
|
|
|
|
|
Are your textBoxes bound to a dataBase table? If not, then have a look here[^] for the DateTime formatting. It's quite simple to follow and helps you get the picture behind it.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank you very much, this helps with the date. I tried to use this with the phone number but it did not work. Can you tell me how to format the phone textbox and load in the phone number, I hope. Thanks again.
Norm
|
|
|
|
|
Yes, you could say something like:
phone.ToString("(###) ### - ####");
Hope this helps.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanks again for you help. Your suggection did not work, I am including some code to give you an idea of what I am trying to do. I am trying to insert a record into a SQL table, it works now I am trying to format the phone numbers. All I get is the format. I hope this helps.
//
// sqlInsertCommand1
//
int rsIdentity;
String format = "(###) ###-####";
SqlCommand cmdGetIdentity = new SqlCommand();
System.Text.StringBuilder b;
try
{
b = new System.Text.StringBuilder(" ");
txtNpets.Text = Convert.ToString(0);
txtHphone.Text = format.ToString();
b.Append("INSERT INTO [owner-info] (salutation, [owner-fname], [owner-lanme], [owner-address] , [owner-city], [owner-state], [owner-zipcode], [owner-home-phone], [owner-work-phone] , [owner-cell-phone], [owner-emgr-phone], [owner-emgr-contact], [owner-email] , [owner-fax-number], [owner-refered-by], pets) values('");
b.Append(txtSal.Text);
b.Append("','");
b.Append(txtFname.Text);
b.Append("','");
b.Append(txtLname.Text);
b.Append("','");
b.Append(txtAddress.Text);
b.Append("','");
b.Append(txtCity.Text);
b.Append("','");
b.Append(txtState.Text);
b.Append("','");
b.Append(txtZcode.Text);
b.Append("','");
b.Append(txtHphone.Text);
b.Append("','");
b.Append(txtWphone.Text);
b.Append("','");
b.Append(txtCphone.Text);
b.Append("','");
b.Append(txtEphone.Text);
b.Append("','");
b.Append(txtEcontact.Text);
b.Append("','");
b.Append(txtEmail.Text);
b.Append("','");
b.Append(txtFphone.Text);
b.Append("','");
b.Append(txtRefered.Text);
b.Append("','");
b.Append(txtNpets.Text);
b.Append("') SELECT @@IDENTITY ");
sqlInsertCommand1.CommandText=b.ToString();
this.sqlConnection1.Open();
sqlInsertCommand1.ExecuteNonQuery();
|
|
|
|
|
Here's a simple example of what I meant before:
string <code>s</code> = "0387465363";
this.textBox1.Text = s;
this.textBox1.Text = String.Format("{0: (##)-###-####}", Convert.ToInt32(s));
Try it this way.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanks again it works! I had to change ToInt32 to Int64.
|
|
|
|
|
You are welcome. Glad I could help
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
I need to ask another qustion? I need to convert the same type of textbox data
to money. I think I can use the same concept you gave me but what would the
the format look like? I tried this: "String.Format("${(0).}", Convert.ToInt32(s))". There is a format error at runtime.
Norm
|
|
|
|
|
Have a look here[^] for all your string formatting questions Norm. I think this will solve your problems.
Hope this helps.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
HI
this is a.xml file i want to display the value of username to label in winform
<resource>
<item name="username">san
<item name="password">Password
<item name="login">Login
<item name="rememberMe">Remember Me?
<item name="usernameRequired">Username required
<item name="passwordRequired">Password required
<item name="invalidLoginInformation">Your username/password could not be found
waiting for th eprompt reply
|
|
|
|
|
In Photoshop CS there is such functionality:
Image>Adjustments>Threshold
I do need to implement such functionality in my c# application, but I don't know how!? Does any of you know where I can find such implementation?
Thanks in advance
|
|
|
|
|
you can try this www.mathtools.net you may find various image processing algorithms written either in c++ or matlab... Alternatively, GOOGLE. Or go read the book from John C Russ, you may find a pseudo algorithm in his book.
edit: you can try the mathworks website and go to the user decidated code section and browse through the image processing section. There is a tonne of image processing code written in matlab.
|
|
|
|
|
Try this peace of code .. instead of giving an error it connects to a ipHostEntry that doesn't exist
Can anyone tell me why ?
Why me ? Oh .. why ?
using System;
using System.Net;
using System.Net.Sockets;
namespace ThisIsStupid
{
public class MainC
{
public static void Main()
{
IPEndPoint ipe = new IPEndPoint( IPAddress.Parse( "193.168.0.6"),21);
//System.Diagnostics.Debug.WriteLine( ipadd );
Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
// Console.WriteLine(s.Connected );
s.Connect(ipe );
if( s.Connected )
{
Console.WriteLine( " I have a socket that didn't connect to nothing ");
Console.WriteLine(" But it's status is connected ");
Console.WriteLine(" Uraaa !");
}
}
}
}
I've made a client - server aplication and my class informes the main program that the requiered connection exists when no client is available there .. ? Why ... is that correct ... what am I doing rong ?
Lazar Mihai
Highschool student
|
|
|
|
|
|
NO .. I tried with port 7891 and with 4545 .. if you have any other suggestions ... try on you computer you'll get the same result
Lazar Mihai
Highschool student
|
|
|
|
|
I extended your class so I could see what was happening. When I tried the other ports you mentioned I got an exception to say that it wasn't connected. When I tried port 21 my application returned:
32 32 30 20 4d 69 63 72 : 220 Micr
6f 73 6f 66 74 20 46 54 : osof t FT
50 20 53 65 72 76 69 63 : P Se rvic
65 d a 0 0 0 0 0 : e
public class MainC
{
private static byte[] buffer = new byte[1024];
public static void Main()
{
IPEndPoint ipe = new IPEndPoint( IPAddress.Parse( "127.0.0.1"),21);
Socket s = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
s.Connect(ipe );
if( s.Connected )
{
Console.WriteLine( " I have a socket that didn't connect to nothing ");
Console.WriteLine(" But it's status is connected ");
Console.WriteLine(" Uraaa !");
}
else
{
Console.WriteLine("Not Connected");
}
int result = s.Receive(buffer, 1024, SocketFlags.Peek);
Console.WriteLine("Received {0} bytes", result);
for(int i=0; i<result; i+=8)
{
Console.WriteLine("{0:x} {1:x} {2:x} {3:x} {4:x} {5:x} {6:x} {7:x} : {8}{9}{10}{11} {12}{13}{14}{15}",
buffer[i], buffer[i+1], buffer[i+2], buffer[i+3],
buffer[i+4], buffer[i+5], buffer[i+6], buffer[i+7],
(char)buffer[i], (char)buffer[i+1], (char)buffer[i+2], (char)buffer[i+3],
(char)buffer[i+4], (char)buffer[i+5], (char)buffer[i+6], (char)buffer[i+7]
);
}
Console.ReadLine();
}
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|