|
For example I write following code;
Point p1 = new Point(0, 0);
Point p2 = new Point(3, 0);
DrawLine(p1, p2);
I want to get painted Point;
"0,0", "0,1", "0,2", "0,3",
|
|
|
|
|
You'll need to implement you're own line drawing algorithm to return those points. There is nothing in the .NET Framework that will do it for you.
|
|
|
|
|
That's not strictly true - he could paint it onto a bitmap of the same size and examine the pixels.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
|
Hi:
I’m trying to create an application using C# which will be responsible to return me the numbers of windows workstation IP from LAN environment.
Can any one suggest me on that…
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
WMI should help. Check this[^] article.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Let me try with this... thanks once again ..
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
how do I use the default language in datetimepicker?
eg computer I set the default language is English! but is still datetimepicker french
|
|
|
|
|
No such thing.
Plus you should always use an ISO 8601 format, e.g. yyyy-MM-dd.
|
|
|
|
|
I Think that is connected to OS language. Since I am using XP with Slovenian language. And I useded DateTimePicker, I got in Slovenian names. You must be missing something. (XP have 3 difrent location settings in Regional settings) gonna tried at home, where I have Win7 english
|
|
|
|
|
Now i am home and i know what affects it.
Under Region And Language (Where you see date and time formats), you need to change Format to specific country
|
|
|
|
|
|
how to send data from computer to computer...i wanaa make lan messenger..pls help me..
|
|
|
|
|
If I start to Google "lan messenger" before I finish typing, I get "lan messenger", "lan messenger free", "lan messenger freeware", "lan messenger open source" and load of others, with millions of results! Just how much research did you do before posting here?
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
CLIENT
SendMessageToClient("192.168.1.3", 8080, textBox1.Text);
private void SendMessageToClient(string pIP, int pPort, string pMessage)
{
try
{
TcpClient tcpClient = new TcpClient();
tcpClient.Connect(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(pIP), pPort));
NetworkStream networkStream = tcpClient.GetStream();
StreamWriter streamWriter = new StreamWriter(networkStream);
streamWriter.WriteLine(pMessage);
streamWriter.Flush();
streamWriter.Close();
networkStream.Close();
}
catch (Exception exception)
{
throw exception;
}
}
--------------------------------------------------------------------------------------------
SERVER
Thread thread = new Thread(new ThreadStart(ListenForSocket));
thread.IsBackground = true;
thread.Start();
private static void ListenForSocket()
{
TcpListener tcpListener = new TcpListener(new System.Net.IPEndPoint(System.Net.IPAddress.Parse("192.168.1.3"), 8080));
tcpListener.Start();
while (true)
{
Socket m_ClientSocket = tcpListener.AcceptSocket();
if (!m_ClientSocket.Connected)
throw new Exception("Not Connect");
NetworkStream networkStream = new NetworkStream(m_ClientSocket);
StreamReader streamReader = new StreamReader(networkStream);
try
{
string message = streamReader.ReadLine();
MessageBox.Show(message);
}
catch (Exception exception)
{
throw exception;
}
}
}
|
|
|
|
|
For a specific url which is opened in IE, I want the details temporay internet files (like images, textfiles, pdfs) of that specific URL. I try to retrieve all those information through wininet functions like FindfirstURLcacheEntry, FindNextURCacheEntry, GetUrlcacheEntryInfo,
I tried to make a log about all the details which can be obtained from temporary internet files for that specific url, I observed that I was unable to get the PDF path which exists in temparary internt files.
How can I get this,
Is there any other method to get that PDF?
If anyone knows something, plz suggest some solution. thank you
|
|
|
|
|
I would use HttpRequest class to request the same page again, then analyze the HTML code and again use HttpRequest to fetch the referenced files of interest.
|
|
|
|
|
Hi,
I am new to C#, I have a doubt please tell me the answer.
I have a form1. In that I am retrieving student information(studentgroup, studentname, admintionnumber). Now
<br />
<br />
namespace student_information<br />
{<br />
public partial class Form1 : Form <br />
{<br />
<br />
string m_stname;<br />
string m_sgroup;<br />
int m_iadminnum; <br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
m_stname = this.textBox1.Text;<br />
m_iadminnum = int.Parse(this.textBox2.Text);<br />
m_sgroup = this.comboBox1.SelectedItem.ToString();<br />
<br />
<br />
Form1 f1 = new Form1();<br />
<br />
f1.m_iadminnum = m_iadminnum;<br />
f1.m_sgroup = m_sgroup;<br />
f1.m_stname = m_stname;<br />
<br />
<br />
}<br />
<br />
}<br />
<br />
}<br />
In the above code what i did is i am receiving information from form1,
Now that information in f1(object). Can any one tell what is the procedure for store this data into a file.
Also please tell me the procedure for retrieving object information from the same file.
Thanx in advance......
sampath-padamatinti
|
|
|
|
|
You can serialize the data using XMLSerializer class and write that to the file. You can deserialize the same to read it back into the object.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
{
m_stname = this.textBox1.Text;
m_iadminnum = int.Parse(this.textBox2.Text);
m_sgroup = this.comboBox1.SelectedItem.ToString();
Form1 f1 = new Form1();
f1.m_iadminnum = m_iadminnum;
f1.m_sgroup = m_sgroup;
f1.m_stname = m_stname;
}
While what you have will work, it is not exactly a good idea. When you create the new instance of Form1
Form1 f1 = new Form1();
you do not just allocate space for m_stname, m_iadminnum, and m_sgroup, you are also creating new instances of textBox1, textBox2, and comboBox1 as well as a whole load of other stuff you can't see - which is not exactly efficient or usefull.
Consider creating a separate class "StudentInfo" to hold your records, which has the name, admin number, and group. You can then give that class a constructor which takes the three parameters, and a Save/Load method which keeps the data neatly encapsulated.
Additional style points:
1) m_stname, m_iadminnum, and m_sgroup are no longer recommended for C# - consider studentName, adminNumber and studentGroup instead.
2) Don't call you controls by the default name: textBox1 is not as usefull as tbStudentName, button1 is less helpfull than butSave and so on. This may not make a big difference now, but when your app gets more complex (and it will) it makes life a whole lot easier.
3) In your button1_Click event, you do not need to prefix your control names with "this." - it is implied. The only time you should have to use "this" is when you have a parameter with the same name as a field.
4) Unless there is a very good reason for it, make your fields private - you can always add a public property if you need to expose them outside your class.
Trust me, it is worth getting these things right from the start - it is a whole lot easier than breaking bad habits later!
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Thanx for valuable suggestion.
sampath-padamatinti
|
|
|
|
|
There is lot of example for messenger or chat application. I did not find any example which will work when computer is behind router. There are many suggession about port forwarding or router configuration but this is not the case when I use Yahoo, MSN, AOL messsenger, skype or P2P. I don't need to do any configuration in my router for this messenger to work.
Is there any idea, example , link how these messenger connect without any router configuration from client side. I read lot of forum but not clear how can I do it. I know how to connect two machine using socket which assumes, machines has public IP address or within local network.
I will really appreciate your idea/ suggession.
Thank you.
|
|
|
|
|
UPnp or Nat search for this on Google and yoju will understand how it works.
In fact it depends on your pre-configured hardware, most of the time UPnp is opened.
|
|
|
|
|
Hi,
I'm trying to send an email that contains a link to verification the users email address.
My problem is how to combine the values inside the hyperlink/
This is what i wrote:
<br />
StringBuilder body = new StringBuilder();<br />
body.Append("<h1>confirm the registration by pressing the link below....</h1>");<br />
body.Append(@"<a href='http://something.aspx?userName=name&tempPass=password'> Click Here </a>");<br />
msg.Body = body.ToString();<br />
how i can replace the name and the password for ex. with-
txtName.text and txtPass.text
Please help me... 
|
|
|
|
|
You can try something like this:
StringBuilder body = new StringBuilder();
body.Append("<h1>confirm the registration by pressing the link below....</h1>");
body.Append(@"<a href='http://something.aspx?userName=");
body.Append(txtName.text);
body.Append(@"&tempPass=");
body.Append(txtPass.text);
body.Append(@"password'> Click Here </a>");
msg.Body = body.ToString();
|
|
|
|