|
yah i'm finding my way now thanks a milion
Hesham Hafez
|
|
|
|
|
Is there a way for me to create a button that isnt square or rectangular?
or maybe something similar
|
|
|
|
|
|
See this thread.
- It's easier to make than to correct a mistake.
|
|
|
|
|
1. is it possible for me to create an application in C# that will allow me to run my hyper terminal or is it possible for me touse commands in my application that will allow me to start programs on my computer????
2. is it possible for two programs to be writing to the same file at the same time?????
kenny
|
|
|
|
|
hiii
if i understood what u wana do right this code may be helpful
you can do so using the System.Diagnostics.Process.Start method as follows:
//just specifying the document name will open the appropriate app based on system settings
Process.Start("Http://msdn.microsoft.com")
//open a word doc
Process.Start(AWordDocument.doc")
Hesham Hafez
|
|
|
|
|
Thanks thats exactly what i wanted to do ...it works fine..............do u know anything about hyper terminal os rs232 connections?
kenny
|
|
|
|
|
Hi,
I am developing a paint application and I have a problem:
The user draws on a UserControl object, then the user has to save the drawings on the UserControl object as a Bitmap file. How can I save the paintings on the UserControl object as a Bitmap file?
thank you
|
|
|
|
|
If they're drawing on the control, then you have a Graphics object. You can use CreateGraphics() on a control to get an instance to draw with, I don't know how to get an instance with the control's existing painting on it. But if you've already got an instance of Graphics that they're using to draw, you can do something like the following...
private void SaveBitmap(Graphics g, Control ctrl) {
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ctrl.Width, ctrl.Height, g);
bmp.Save(@"C:\bmp.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
}
Hope that helps, without a little more info I'm not sure it answers your question though.
Visit BoneSoft.com
|
|
|
|
|
Hi,
I tried your method but it didn't work, I get a black bitmap.
My problem is:
I have a UserControl object that I draw onto. There are lines, rectangels, circle on it. I want to save these drawings into a bitmap file. How can I do that?
|
|
|
|
|
How could i get (and then set) ASCII code of a character?For example when i pass a character A i want to get the ASCII code of it.If i change the ASCII code of a character does its function will change?I change the ASCII code of character A to B.Does character A change to B?Thanks for reading
|
|
|
|
|
Do you really mean ASCII character codes? The Char data type in .NET is a Unicode character, so it doesn't use ASCII characters codes. If you want to use ASCII character codes you would have to encode the string into ASCII, and that leaves you with an array of bytes that you can't use as text unless you decode it again.
Assuming that you mean Unicode character codes, and not ASCII character codes:
The Char data type is a 16 bit value that represeents a Unicode character. You can easily convert between Char and Int32, and manipulate the value in either form:
char c = 'A';
c++;
c += '!';
int i = (int)c;
i++;
char d = (char)i;
---
b { font-weight: normal; }
|
|
|
|
|
This code does that:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
char c = 'A';
int i = Convert.ToInt32(c);
Console.WriteLine(c);
Console.WriteLine(i);
++i;
c = Convert.ToChar(i);
Console.WriteLine(c);
Console.WriteLine(i);
}
}
}
Hope this helps.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
You can get/set ACSII code for any of the character and vice versa as follows:
// The encoding.
ASCIIEncoding ascii = new ASCIIEncoding();
//Conversion From ACSII code to character
Byte[] decodedBytesForChar= ascii.GetBytes("A"); //returns ACSII code for character A i.e. 65
Console.WriteLine("ACSII code for character A = {0}", decodedBytesForChar[0]);
//Conversion From ACSII character to code
Byte[] encodedBytes = new Byte[1];
encodedBytes[0] = 97;
Console.WriteLine("ACSII character for code 97 = {0}", ascii.GetString(encodedBytes));
Rizwan
|
|
|
|
|
thanks for all replies.I want to reassign the function of the keyboard.For example when i press A on the keyboard it will print B or something else on the screen.This what i mean "set" (reassign)ASCII code.Can anyone help me?Thanks again
|
|
|
|
|
Hi, I'm working on a very simple socket communication program. It needs to connect, send a string, and disconnect. However, I need to know if the connect is terminated by the remote client before I try to disconnect (this is a requirement of the remote client software before my code is "certified").
I have the following code:
<br />
EndPoint ep = new IPEndPoint(IPAddress.Parse(sServerIP), iPort);<br />
Socket sockBatch = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); <br />
sockBatch.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 30000);<br />
sockBatch.Connect(ep);<br />
if (sockBatch.Connected)<br />
{<br />
Encoding ASCII = Encoding.ASCII;<br />
Byte[] byteDataLine = Encoding.ASCII.GetBytes(sSendData.ToCharArray());<br />
sockBatch.Send( byteDataLine, byteDataLine.Length, 0 );<br />
<br />
Byte[] RecvBytes = new Byte[256];<br />
Int32 bytes = sockBatch.Receive(RecvBytes, RecvBytes.Length, 0);<br />
StringBuilder sbResponse = new StringBuilder();<br />
sbResponse.Append(ASCII.GetString(RecvBytes, 0, bytes));<br />
string sResponsePacket = string.Empty;<br />
while ((sockBatch.Connected) && (bytes > 0) && (-1 == sbResponse.ToString().IndexOf(sEndMarker)))<br />
{<br />
bytes = sockBatch.Receive(RecvBytes, RecvBytes.Length, 0);<br />
sResponsePacket = ASCII.GetString(RecvBytes, 0, bytes);<br />
sbResponse.Append(sResponsePacket);<br />
}<br />
}<br />
<br />
loggerBatch.Info("TEST DELAY before disconnect socket");<br />
for (int iWait = 0; iWait < 1 * 60; iWait++)<br />
{<br />
Thread.Sleep(1000);<br />
}<br />
<br />
bool bPoll = sockBatch.Poll(10000, SelectMode.SelectWrite);<br />
loggerBatch.Info("Batch Socket Write poll: {0}", bPoll);<br />
<br />
bool bPoll1 = sockBatch.Poll(10000, SelectMode.SelectError);<br />
loggerBatch.Info("Batch Socket Error poll: {0}", bPoll1);<br />
<br />
loggerBatch.Info("Batch Socket is connected: {0}", sockBatch.Connected);<br />
if (bPoll && sockBatch.Connected)<br />
{<br />
loggerBatch.Info("Poll says connected");<br />
try<br />
{<br />
byteDataLine = Encoding.ASCII.GetBytes("AYT".ToCharArray());<br />
sockBatch.Send( byteDataLine, byteDataLine.Length, 0 );<br />
}<br />
catch (Exception ex)<br />
{<br />
logger.Info("AYT Error: {0}", ex.ToString());<br />
}<br />
<br />
loggerBatch.Info("Disconnect from socket");<br />
sockBatch.Shutdown(SocketShutdown.Both);<br />
sockBatch.Close();<br />
}<br />
else<br />
{<br />
loggerBatch.Info("Socket was disconnected.");<br />
}<br />
Output of above
<br />
2006-06-16 10:19:59.7241|INFO|batch|TEST DELAY before disconnect socket<br />
2006-06-16 10:20:59.7233|INFO|batch|Batch Socket Write poll: True<br />
2006-06-16 10:20:59.7390|INFO|batch|Batch Socket Error poll: False<br />
2006-06-16 10:20:59.7390|INFO|batch|Batch Socket is connected: True<br />
2006-06-16 10:20:59.7390|INFO|batch|Poll says connected<br />
2006-06-16 10:20:59.7546|INFO|main|AYT Error: System.Net.Sockets.SocketException: An established connection was aborted by the softw<br />
are in your host machine<br />
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)<br />
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 size, SocketFlags socketFlags)<br />
[snip]<br />
2006-06-16 10:20:59.7546|INFO|batch|Disconnect from socket<br />
I know that while I am in the delay section the socket connection is terminated (TCP FIN and/or TCP RST). However, the Connected property gives me nothing (I realize it only reports state at last activity), but the Poll method supposedly will let me know the current state. I get an error when I try to send the AYT (for testing), but this is unacceptable for production as I can't send unexpected data down the line.
Any ideas on what to try?
TIA
|
|
|
|
|
Is it possible to set the default button on a user control in the same way you would set myForm.AcceptButton = button for a Form.
|
|
|
|
|
Hello everyone,
I wanted to make a simple moonphase application for my Windows based smartphone, showing the current moonphase, and possibly other information too (moon calendar, moonrise and set times, etc). However, I can't find any C# code or library for these calculations (just some python and Java).
Does anyone know about anything (a .NET library or C# code?)
I'd be very grateful!
Thanks,
Rado
Radoslav Bielik
www.neomyz.com/poll [^] - Get your own web poll
www.neomyz.com/rss [^] - RSS Web Reader - latest news for your site
www.neomyz.com/games [^] - Add a small game to your website
|
|
|
|
|
Unless you can find an oss app to steal from you're going to have to do this yourself. The actual formulas should be findable without too much effort, but this is too obsure a role to have a dedicated public library available.
|
|
|
|
|
|
Thanks Ravi, I'll try that. Actually, I've already seen Siamak's website, and was thinking that maybe I could write him if I don't find anything else, so it seems that will be the way to go.
I also found a nice Java mobile application - which does much more than the moon phase calculation - it's a compass for navigating by sun/moon position on the sky. I've been thinking that I may try to port that into C# and create a smartphone version, just for fun. It works on a smartphone too, but still could be improved. But I'm not sure I have enough time for that.
Rado
Radoslav Bielik
www.neomyz.com/poll [^] - Get your own web poll
www.neomyz.com/rss [^] - RSS Web Reader - latest news for your site
www.neomyz.com/games [^] - Add a small game to your website
|
|
|
|
|
I have seen a program which could change the function of the keyboard.For example when you press letter A on the keyboard it will print B to the screen.Can i write a program like that using C#?Thanks for reading
|
|
|
|
|
Dear Friends,
I have a class with two Member variables inside it as follow :
<code>
public class MyView
{
private string name;
public string Name
{
get{return this.name;}
set{this.name = value;}
}
private DataView dv;
public MyView(string vName)
{
this.dv = new DataView();
this.name = vName;
}
}
</code>
I dont want to set the internal DataView variable to public and I want to use Binding when using this class as follow.Suppose that the BindGridView method is a method in a windows form class :
private void BindGridView()
{
MyView viewOnject = new MyView("SampleView");
this.dataGridView1.DataSource = viewObject;
}
How can I do this ?
Note : I dont want to set the internal DataView variable to public or expose it as a public property.
Best Regards,
Xironix
[ _ Always there is another way _ ]
-- modified at 12:20 Friday 16th June, 2006
|
|
|
|
|
Hello all,
I created a Setup which will installs an assemblie in GAC. my setup is instaling assemble in GAC. it is fine.
problem is assembly physical location is C:\Program Fles\ABC\MyDLLProject
here DbConnection.txt file is also copying alng with installation. but my Shared assembly needs connection string. i.e exists at above location and DLL is at C:\Windows\Assembly.
Where i will copy DbConnection.txt file?
|
|
|
|
|
I don't want solutions, just a quick yes, but... or ha ha, you've gotta be kidding...
From an ASP.NET C# codebehind page, I want to shell out to an executable (legacy C++), capture the output (it writes to std::out), and then render it (the easy bit).
What are my chances? If this is possible, I will do more investigation, if I have no chance, then I will rethink the solution.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|