|
Ok. Thank you. I should have taken the Enabled = false property instead of the Stop -method in my DoubleClick -event. I will try again.
|
|
|
|
|
The Stop method sets Enabled to false . If the Elapsed event is still getting fired, then perhaps your interval is too quick. To get the user-defined double-click time, see SystemInformation.DoubleClickTime . You should always use what information you can from the OS in relation to things like this, especially when honoring user preferences (otherwise they tend to get upset).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I am trying to access a Solaris Unix box from .Net windows form application using sockets or tcpclient classes. I need to send and execute some type of command script that can disable and enable ip/ports on the unix box.
I am not use to the unix environment, therefore I may be doing this totally wrong. If anyone has any code already to share with me that would be great!!
The problem is reading data from a Solaris Unix box. I can get connected to the IP and Port, I can also write to it, but when I read from it nothing happens. No error is produced, no timeout is produced, it just hangs there.
If I Telnet into the same IP I get a login screen. Could this be the hang up? Should I be passing a login and password first?
Below is my code that I am using:
IPAddress myIP = IPAddress.Parse(strIP);
string sszPort = strPORT;
int alPortt = System.Convert.ToInt16 (sszPort,10);
TcpClient Telnet = new TcpClient();
try
{
Telnet.Connect(myIP, alPortt);
Stream TelnetStream = Telnet.GetStream();
if(TelnetStream.CanRead & TelnetStream.CanWrite)
{
MessageBox.Show ("Can Read and Write");
byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes("USER <username>\r\n");
TelnetStream.Write(sendBytes, 0, sendBytes.Length);
byte[] bytes = new byte[Telnet.ReceiveBufferSize];
TelnetStream.Read(bytes, 0, bytes.Length);
returndata = Encoding.ASCII.GetString(bytes);
MessageBox.Show("This is what the host returned to you: " + returndata);
}
else
{
MessageBox.Show("Cannot Read");
}
catch(Exception ee)
{
string excepstr = ee.Message;
}
Telnet.Close();
|
|
|
|
|
Off hand, I can tell you that telnet uses the default port 23. You seem to be using 10. So, telnet'ing into the box isn't a valid test if you don't specify a port. Instead, try "telnet machinename 10" on Windows. Trying typing your data directly and see what's happening then.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi, how do u change the color of the row in datagrid according to their sort.
(sorted by Proj)
Proj Activity
yesh hihi <== this row will be red
yesh byebye <== this row will be red
yesh hoho <== this row will be red
lolo hihi <== this row will be white
lala byebye <== this row will be red
lala byebye <== this row will be red
(sorted by Activity)
Proj Activity
yesh hihi <== this row will be red
hihi hihi <== this row will be red
lolo hihi <== this row will be red
lala byebye <== this row will be white
lolo lalala <== this row will be red
yesh lalala <== this row will be red
this is a sample where there is more columns, rows and values.
Thank you.
|
|
|
|
|
I’m a bit of a nubie and looking for some advice, the code bellow works but looks like a bit of a hack. I know it's a 'WebMethod' its general enough. My concerns lie with the 'Populate product' section toward the bottom.
[WebMethod]<br />
public Product GetProductById(int Id)<br />
{<br />
#region oleDbQueery<br />
OleDbDataAdapter myAdapter = new OleDbDataAdapter();<br />
OleDbCommand myCommand = new OleDbCommand("ProductByIdQueery", oleDbConnection1);<br />
myCommand.CommandType = CommandType.StoredProcedure;<br />
OleDbParameter parameterid = new OleDbParameter("Id",OleDbType.Integer);<br />
parameterid.Value = Id;<br />
myCommand.Parameters.Add(parameterid);<br />
myAdapter.SelectCommand = oleDbSelectCommand1;<br />
myAdapter.SelectCommand = myCommand;<br />
#endregion<br />
DataSet ds = new DataSet();<br />
oleDbConnection1.Open();<br />
myAdapter.Fill(ds);<br />
oleDbConnection1.Close();<br />
Product myProduct = new Product();<br />
myProduct.Id = Int32.Parse(ds.Tables[0].Rows[0]["Id"].ToString());<br />
myProduct.Category = Int32.Parse(ds.Tables[0].Rows[0]["Category"].ToString());<br />
myProduct.ShortTitle = ds.Tables[0].Rows[0]["ShortTitle"].ToString();<br />
myProduct.FullTitle = ds.Tables[0].Rows[0]["FullTitle"].ToString();<br />
myProduct.Price = double.Parse(ds.Tables[0].Rows[0]["Price"].ToString());<br />
myProduct.CurrentQuantity = Int32.Parse(ds.Tables[0].Rows[0]["CurrentQuantity"].ToString());<br />
return myProduct;<br />
}
Sorry for the long snippit. My passed in 'Id' would refer to a unique db key so the dataSet 'should' only ever contain one row.
Do I have to go via a dataSet to populate myProduct object?
All comments greatly welcomed.
tia
|
|
|
|
|
You can use a DataTable instead of a DataSet.
The DataAdapter.Fill() method works with a DataTable object.
Free your mind...
|
|
|
|
|
Try a DataReader.
Thank You
Bo Hunter
|
|
|
|
|
|
I'm writing a control program that will require a lot of screen real estate to interact with the user. One thought I had on how to do this was to use a dual output display adapter and two monitors. I would then create forms that would present specific information on each monitor. My question is how to control which of the two monitors the form is drawn on?
Jeff
|
|
|
|
|
I would recommend looking into documentation for the following keywords:
GetSystemMetrics();
SM_CMONITORS;
SM_XVIRTUALSCREEN;
SM_YVIRTUALSCREEN;
SM_CXVIRTUALSCREEN
SM_CYVIRTUALSCREEN
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Or, since this is the C# forum, see the System.Windows.Forms.SystemInformation class, which includes several properties that wrap such information in a managed class.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Seeing that the others are throwing u off track, have a look at System.Windows.Forms.Screen
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Hello all,
I have to set certain values in a datacell based on its orginial value. So 0 stands for Ended, and 1 stands for in progress. For whatever the reason, Im having a difficult time changing the text of a cell in my datagrid. Im sure im doing something stupid, whats wrong with this picture?
DataGridCell oCell;
for(int k = 0; k <= gridEvent.VisibleRowCount; k++)
{
oCell = new DataGridCell(k, 4);
if(gridEvent[oCell].ToString() == "1")
{
gridEvent[oCell] = "In Progress";
}
else
{
gridEvent[oCell] = "Ended";
}
}
}
It throws an error that no set method is provided for the cell object. Am I missing something?
Thanks,
Ryan
|
|
|
|
|
Sorry, I just realized that the datagrid's first element is 1 not zero, where in lies my problem.
Thanks,
Ryan
|
|
|
|
|
OK, not zero, but i figured it out.
Thanks anyways,
Ryan
One of those days.
|
|
|
|
|
We are developing a C# application using .Net AsyncCallback delegates. The application currently executes, as expected,
using these asynchronous methods. Once this application is converted to a COM+ component (i.e. a .NET serviced component)
the program ceases to execute properly and 'hangs' without asynchronously executing the callback delegates.Any help with .Net asynchronous programming under COM+ would be grealty appreciated. Thanks. Rick
Rick
|
|
|
|
|
|
I am handling the double click event on a form (not a control) and I want to know the location of the double click. How? It was easy for a mouse up/down/hover/etc, it was part of the MouseEventArgs. That info is unavailable for the DoubleClick Event. Why? aaaaarrrrrggggg!
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Try using the static System.Windows.Forms.Form.MousePosition .
Andreas Philipson
|
|
|
|
|
Thanks, I had already tried that and didn't get the results I was looking for...then it dawned on me to call PointToClient before I used it. Works fine, now.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
can anyone tell me what kind of help C# or .NET Framework provides to find all/any I/O device(s) installed in the system?
|
|
|
|
|
None. .NET (btw, C# is a language that only targets .NET - nothing special in and of itself) is a higher-level platform. C# and a few other languages that target the CLR do let you use lower-level programming with pointers in an unsafe context, but P/Invoking (calling Win32 native functions) what you need to accomplish what you want, and creating all the structs and what not, would be very time-consuming. Using C# (or the .NET Framework in general) would not be the way to go.
If you need this information in a .NET application, consider putting such functionality in a Win32 DLL and P/Invoking it, or - perhaps better - create a COM object that does this and get that information in a much simplier COM interop call.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Is there any way to make a single control usable on both Windows Forms and Web Forms?
|
|
|
|
|
Interesting question... doesn't a forms control have to inherit from System.Windows.Forms.Control and a web control System.Web.UI.Control in order to function correctly in their repsective environments?
Are you looking to make any control in particular?
|
|
|
|