|
hi
how i can connectiong to internet IN my program.
i must enter username & password & my asp number in my program and then conencting to internet.
plz give me small smaple;
|
|
|
|
|
M M A wrote: i must enter username & password & my asp number in my program and then conencting to internet
Who is stopping you???
Jokes apart, you need to give us the details what you need to do.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I have a class with a scientific members in physics. I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time.
(Lets say that i have properties that called "x1", "x2" and "x3".)
How can i do it?
|
|
|
|
|
Have a look at Inside the Mathematical Expressions Evaluator[^].
bonzaiholding wrote: I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time.
(Lets say that i have properties that called "x1", "x2" and "x3".)
You can search the input string for the variables ("x1", "x2", ...) and replace them with their corresponding values from your properties. After that, you can pass the string to the Mathematical Expressions Evaluator and get the result.
Nuri Ismail
|
|
|
|
|
Thanks for all of your answers.
|
|
|
|
|
You are looking for a Math parser. You can find lot of related help on google.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Sigh, I remember having to do this at uni....RPN anyone? Seriously though look up Reverse Polish Notation and stacks. It might help...it might not I am not very helpful am I? I just went on a nostalgia trip is all because of your post! thank you
Cads
|
|
|
|
|
|
private bool Connect()
{
string DB_Path= @"E:\Office Project\salary project\AttendanceSummary.csv";
string Con_Str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DB_Path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";";
con = new OleDbConnection(Con_Str);
con.Open();
string query = "SELECT SNO, ECODE, NAME, PRESENT, ABSENT, OFF, LEAVE, LWP, OTHOURS FROM [AttendanceSummary$]";
OleDbDataAdapter oda = new OleDbDataAdapter(query, con);
DataSet ds = new DataSet();
oda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Update();
if (con.State == ConnectionState.Open)
{
MessageBox.Show("Connected");
return true;
}
else
return false;
}
====>>>> this code is working fine...........Problem is that when i am connecting other file "XYZ.XLS" which is having some text heading in the Top Rows................ its showing error ....... pls kindly help me
Thanks in Advance.( sorry if any mistake i am very new to programming)
|
|
|
|
|
Thanks I GOT 
|
|
|
|
|
Hey guys
I'm trying to communicate with an external device(proximity card reader) over TCP/IP.
At the moment im able to send the device a packet and receive a reply from the device. The problem is, that when i try to send a second packet I get an IOException at NetworkStream.Write(Buffer, 0, Buffer.Length); stating "Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host."
This makes no sense to me, the device does not close the connection, I am 100% sure of that.
Here is the code of my test program.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace NewBadgerTest
{
public partial class Form1 : Form
{
TcpClient BadgerConnection;
public Form1()
{
InitializeComponent();
try
{
BadgerConnection = new TcpClient();
BadgerConnection.Connect(IPAddress.Parse("10.0.0.100"), 1111);
this.Text += " - Connected";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error while connecting", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button1_Click(object sender, EventArgs e)
{
if (BadgerConnection.Connected)
{
byte[] Buffer = new byte[]
{
161,
15,
89,
1,
89,
3,
102
};
NetworkStream ns = BadgerConnection.GetStream();
ns.Write(Buffer, 0, Buffer.Length);
ns.Flush();
string Reply = GetReply(BadgerConnection.GetStream());
MessageBox.Show(Reply);
}
}
public string GetReply(NetworkStream ns)
{
StringBuilder result = new StringBuilder();
try
{
byte[] Buffer = new byte[1024];
while (true)
{
if (ns.CanRead)
{
int numberOfBytesRead = 0;
while (ns.DataAvailable)
{
numberOfBytesRead = ns.Read(Buffer, 0, Buffer.Length);
result.AppendFormat("{0}", Encoding.ASCII.GetString(Buffer, 0, numberOfBytesRead));
}
if (result.Length > 0)
{
break;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return result.ToString();
}
}
}
For simplicity's sake the part where a reply is read is not in a different thread although when I do it like that the result is the same.
Can someone please shed some light on what might be the cause of this problem? Cause I'm running out of ideas and things to try.
Thanks
<Update>
I've been playing around with this more and got two new pieces of information.
As pradnya_k suggested I downloaded process explorer and realized that the connection dies after I call NetworkStream.Write() sometimes it dies even before I get my packet from the device I'm talking too. Then the exception only gets thrown when I try to call NetworkStream.Write() again whice is exactly what was said in some TCP articles I've read.
The second thing I was able to figure out was that the WSE error code that gets thrown is 10054: WSAECONNRESET
WSAECONNRESET
10054
Connection reset by peer.
An existing connection was forcibly closed by the remote host. This normally results if the peer
application on the remote host is suddenly stopped, the host is rebooted, the host or remote network
interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the
SO_LINGER option on the remote socket). This error may also result if a connection was broken due to
keep-alive activity detecting a failure while one or more operations are in progress. Operations that
were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.
</Update>
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
modified on Monday, September 21, 2009 8:32 AM
|
|
|
|
|
Hi,
You can download Process Explorer from following link.
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
It will show you all the TCP/IP connection.
You can check here if the connection is getting closed.
Initially the connection status will be ESTABLISHED but if the device is closing it, the connection will go to CLOSE_WAIT state.
You can also use Smart sniffer to check the communication between your machine and the device.
Thanks
|
|
|
|
|
Does your device has any setting related to session timeout or keep alive time?If there is such a setting then the reader must be closing the socket when that time interval is elapsed.
|
|
|
|
|
Anyone please tell me how to add password column to datagridview in C#.
thanks.
|
|
|
|
|
You need to convert the password column into a template column.
Then using the smart tags, edit the template column and change the display of the textbox based on the type of data it is holding.
|
|
|
|
|
//
// dataGridView2
//
this.dataGridView2.AllowUserToAddRows = false;
this.dataGridView2.AllowUserToDeleteRows = false;
this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.inteSetupI,
this.inteExtPlanTool,
this.inteExtPlanToolDB,
this.inteExtPlanToolUID,
this.inteExtPlanToolPW});
this.dataGridView2.Location = new System.Drawing.Point(6, 6);
this.dataGridView2.Name = "dataGridView2";
this.dataGridView2.Size = new System.Drawing.Size(716, 300);
this.dataGridView2.TabIndex = 0;
//
// inteExtPlanToolPW
//
this.inteExtPlanToolPW.HeaderText = "External Planing Tool Password";
this.inteExtPlanToolPW.Name = "inteExtPlanToolPW";
this.inteExtPlanToolPW.Resizable = System.Windows.Forms.DataGridViewTriState.True;
thank you ravimori to answer my question.this is my code.i want to use "inteExtPlanToolPW" culomn as password fild.can explain it with code.thank you.
|
|
|
|
|
I want to have the application automatically log the user out when there is no user input for at least 10 minutes.
I use a background timer to count seconds, and I use the MouseMove event to reset the counter to zero to account for user input.
Trouble is, even when the mouse is not moving, but resting upon the application window, the MouseMove event raises by itself about every 30 seconds!
Is there a better way to time out the user without relying on the MouseMove event?
|
|
|
|
|
You could track the last mouse position and see how long it's been since it moved a certain distance. What if the user is typing something, does you app ever allow for a task that may take 10 minutes on the keyboard ( such as filling in a form and using TAB to go between controls ) ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
hey
i have a site and i bulid administrator section where he can upload Images to the site.
the images sould be on Size 532x301 so im resizing them with this method
Bitmap b;
Image i;
Graphics g;
b = new Bitmap(width, height);
i = Image.FromHbitmap(b.GetHbitmap());
g = Graphics.FromImage(i);
g.DrawImage(img, 0f, 0f, width, height);
g.Dispose();
img.Dispose();
return i;
after the resize the image file size is 0.5 MB (it was 5mb before)...
i want to reduct the image file size to (100k -200k) so the site could be faster,
also i dont have alot of space on my host...
can anyone help me ?
|
|
|
|
|
michael@cohen wrote: b = new Bitmap(width, height);
i = Image.FromHbitmap(b.GetHbitmap());
g = Graphics.FromImage(i);
How utterly bizarre. This is a waste of time. You can call Graphics.FromImage on a Bitmap, in fact, because of bugs in .NET, even if you create an Image, a Bitmap is created.
You should use using blocks to auto dispose where you can.
If you want images to be smaller, try saving them as jpeg or another compressed format. Otherwise, they are the size of the number of pixels x 3, you can't change that.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
your code could be simplified to a single constructor, see new Bitmap(Image, Size) , however that would lead to the same result.
As Christian said, the smallest file will be obtained by saving it in a format that applies compression, so use JPEG for it.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I have installed the SNMP in my machine and the printer Server.
The printer Server is a PC,its OS is WinXP.
The PC is in another subnet to my Loacal PC.
Now i can obtain the Printer's name and the other infomation by SNMP.
But i want to obtain the total printing pages.
Can i use MIB to do it? Any help will be appreciated!
modified on Monday, September 21, 2009 4:46 AM
|
|
|
|
|
Hi,
Please help me on the thread scheduling problem described below.
The method Play() plays a sound file using WMPLib and
the method DoSomething() does some kind of time consuming tasks (just for testing).
I wonder why the two cases below showed me different results in spite of using thread for asynchronous processing.
It's been killing me...
public void Play()
{
player.controls.stop();
player.currentMedia = player.newMedia(path);
player.controls.play();
}
public void DoSomething()
{
int z = 1;
for(int i=0; i<1000000; i++) {
z = i + 1000;
z = z - 1000;
string str = "Test String";
str = str + " What's up?";
}
MessageBox.Show("Something done");
}
private void button1_Click(object sender, EventArgs e)
{
Play();
ThreadPool.QueueUserWorkItem(new WaitCallback(DoSomething));
}
private void button2_Click(object sender, EventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(Play));
DoSomething();
}
Thanks in advance.
Roh
modified on Monday, September 21, 2009 10:37 PM
|
|
|
|
|
Kwonhyung Roh wrote: showed me different results
And those would be ....??
You've got one major problem that I see. You're launching a MsgBox and touching UI controls from a non-UI thread. Both are not good ideas and can give you screwy results.
|
|
|
|
|
Thanks.
In case1, it starts playing the sound file and, at the same time, starts DoSomething. And while the sound file is being played, the MessageBox shows up which means end of DoSomething. (Asynchronous)
But in case2, DoSomething starts first. After showing up the MessageBox, it starts playing the sound file. (Synchronous)
I used the MessageBox just to mark the end of DoSomething.
And codes for the method Play() were originally parts of the event handler.
(But it made no difference.)
I rewrote them as the method for convenience' sake.
Thanks again.
Roh
|
|
|
|
|