|
when I am pressing backspace I want some variable value should change(i=3).So how to do it
|
|
|
|
|
Hi,
You can write the code in KeyPress event. You get e.KeyChar. Check if it is Backspace and if yes execute some code. as simple as that !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Hi,
In my application i need to know when the monitor has changed state from stby to normal.
I know how to put it to stby using SendMessage, but what i need to know is when it wakes up (when the user uses the mouse or keyboard, for eg..).
Any help is appreciated.
Roy
|
|
|
|
|
I have unmanged DLL (legacy - can't touch it!) which returns an XML string. I want to bind this string to a datagrid....easy...or it should be. But I can't. I've isolated the problem below. To get the xml string into a dataset, I use a StringReader and use ReadXml . But when binding to Datagrid, it only shows the root node if I haven't pre bound the columns, or if I have, it complains the field isn't there (as it only exists in teh child nodes). I have saved the output from the Unmanaged DLL to an XML file which can be parsed, so the format is correct.
To test, I use two methods of populating the grid. The first one works fine, loading the XML file into an XMLDataSource . The second one doesn't - loading the XML file into a DataSource , via ReadXML . It is this second optoin I need to work, or some method of doing this where i can pass an XML string in.
works a treat, but I can't use as I have to receive from a string, not a file
XmlDataSource xds = new XmlDataSource();
xds.DataFile = ("d:/test.xml");
GridView1.DataSource = xds;
GridView1.DataBind();
doesn't work as it only seems to look at root node.
DataSet ds = new DataSet();
System.IO.StreamReader str = new StreamReader("d:/test.xml") ;
StringReader rdr = new StringReader(str.ReadToEnd());
ds.ReadXml(rdr);
GridView1.DataSource = ds;
GridView1.DataBind();
Any ideas?
Regards
Malc
*********************************************
|
|
|
|
|
err
maybe you should use ReadXmlSchema().
|
|
|
|
|
The Dataset, read from an XML string contains multiple tables. The first table (the default) is the root node, the second table, contains the child nodes...so...changing the following line works a treat..
GridView1.DataSource = ds.Tables[1];
Regards
Malc
*********************************************
|
|
|
|
|
Hi Guys,
I'm tryin to Post an xml string to a web service which returns an xml string use WebRequest.
I'm getting the following error.
Error in Order System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream()
Any hints tips or preferable solutions!!!!
Thanks in advance
Will
Will
I'm a man who discovered the wheel and built the Eiffel Tower out of metal and brawn. That's what kind of man I am. You're just a woman with a small brain. With a brain a third the size of us. It's science. - Ron Burgundy - Anchorman
|
|
|
|
|
Can anyone tell me howa user can connect to the internt using my software. I want the user to be able to feed in the username and password and when Connect is clicked - the application connects using a network conmection on the computer. I would also be able to check wether authentication was successful and the connection state. Whioh library do i have to use. I tried googling it up but i couldnt find anything specific. I believe it is called "RAS" - am i correct? Thanks all.
|
|
|
|
|
Hello
Why use a 3rd library. You got all you need in System.Net namespace and namespaces derived from it like System.Net.NetworkInformation
Regards
|
|
|
|
|
Dear gurus,
I have a generics question.
// T is either Int32 or Double
void fkt<T>( ref T someValue ) where T : IConvertible
{
Int32 i = 5;
someValue = i; <---- compiler error here
someValue = (T)i; <---- compiler error here
}
In both cases I get a type conversion error
How can I handle this? I know in advance, that T is only Int32 or Double.
Thanks for your help
-- modified at 4:58 Thursday 17th August, 2006
|
|
|
|
|
T i = 5;
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hallo,
does not work. Still same compiler-error-message
Kind regards
|
|
|
|
|
void fkt<t>(ref T someValue) where T : IConvertible
{
IConvertible i = 5;
someValue = (T)i;
}
Generics kind of suck. They aren't a pimple on the backside of C++ templates.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Wow ! ! !
Thank you ! ! !
You seem to be an absolute expert.
But two new questions arise: -))
1.
From where can I get such know-how? Is there any good book/paper available on such details?
2.
How can I restrict my Generic Type <t> to the basic datatypes as e.g.: char, int, double,..
fct<t>( T value ) where T: ...basic numeric types only ...
Kind regards
-- modified at 7:27 Thursday 17th August, 2006
|
|
|
|
|
Tomerland wrote: From where can I get such know-how? Is there any good book/paper available on such details?
*blush* I googled it. I've only really used generics for typed containers, I was interested enough to know more that I was willing to spend a little time researching it and playing with a sample app.
Tomerland wrote: How can I restrict my Generic Type to the basic datatypes as e.g.: char, int, double,..
http://msdn2.microsoft.com/en-us/library/d5x73970.aspx[^]
It looks to me like it's not possible.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello
Christian Graus wrote: It looks to me like it's not possible
I believe it is. This method should only work with int and double types only
private void CreateMethod<T>() where T : IComparable<int> , IComparable<double>, new()
{
T instance = new T();
MessageBox.Show(instance.ToString());
}
Regards
|
|
|
|
|
This won't compile as you put IComparable twice. However, one fixed, it seems to work with only numeric types. I had no idea you could put
int n = new int();
It seems kind of redundant to me.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello
Actually there was an error due to CP script. Sorry I have to remove the pre tag. Here is the correct code
private void CreateMethod<T>() where T : IComparable<int> , IComparable<double>, new()
{
T instance = new T();
MessageBox.Show(instance.ToString());
}
and why you call the new() redundant?? How would you declare your types in the method otherwise??
Regards
-- modified at 8:41 Thursday 17th August, 2006
|
|
|
|
|
T instance; ( if T is an int or a double. )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yeah, I didn't know you could use new with value types either. I guess I've just never tried.
|
|
|
|
|
hi guys!
need some help..
i have to make a management console type application which will install software on remote machines in a network .. using c#
can any one tell me where to start from..any useful links or tutorial etc..
will using winsock is a good idea?
abhinav
|
|
|
|
|
Hi.
I have created a class that read data from the database and i want to display this data on labels.
here is my class
public void SeachProduct(string PBarcode,string PName,string PPrice)
{
Barcode = PBarcode;
ProductName = PName;
Price = PPrice;
SqlConnection conn1 = new SqlConnection();
conn1.ConnectionString = "integrated security=SSPI;initial catalog=Phusa;server = za211149;persist security info=False";
conn1.Open();
try
{
SqlCommand cmdSearch1 = new SqlCommand();
cmdSearch1.Connection = conn1;
cmdSearch1.CommandText = "SELECT ProductName,Price FROM Products WHERE Barcode=@Barcode";
SqlParameter Bar = new SqlParameter();
Bar.ParameterName = "@Barcode";
Bar.Direction = System.Data.ParameterDirection.Input;
Bar.Value = Barcode;
cmdSearch1.Parameters.Add(Bar);
SqlParameter Nam1 = new SqlParameter();
Nam1.ParameterName="@ProductName";
Nam1.Direction = System.Data.ParameterDirection.Output;
Nam1.Value =ProductName;
cmdSearch1.Parameters.Add(Nam1);
SqlParameter Pri= new SqlParameter();
Pri.ParameterName = "@Price";
Pri.Direction = System.Data.ParameterDirection.Output;
Pri.Value = Price;
cmdSearch1.Parameters.Add(Pri);
SqlDataReader dr1 =cmdSearch1.ExecuteReader();
if(dr1.Read()==true)
{
//MessageBox.Show("Product found");
ProductName= dr1["ProductName"].ToString();
Price = dr1["Price"].ToString();
}
else
{
MessageBox.Show("Product not found");
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn1.Close();
}
and here i am try to call so that it can display data on the labels my class on form
SearchCustomers search = new SearchCustomers();
string Barcode;
string ProductName="";
string Price = "";
Barcode = txtBarcode.Text;
search.SeachProduct(Barcode,ProductName,Price);
lblProductName.Text = ProductName;
lblPrice.Text =Price;
}
-- modified at 4:03 Thursday 17th August, 2006
|
|
|
|
|
To make your code work as it is now, you have to use the "ref" keyword on the parameters, so that the method can change the strings that you send into it:
public void SeachProduct(string PBarcode, ref string PName, ref string PPrice)
and
search.SeachProduct(Barcode, ref ProductName, ref Price);
To use reference parameters in this ways is rarely used, though. Store the values in the search object instead, and expose them through properties.
---
b { font-weight: normal; }
|
|
|
|
|
I can't create uninstal project in my .NET 2003 Setup and Deployment Project. How can I do it?
Thank you for your help...
This is my sign
|
|
|
|
|
Hello
Wait a minute!! I thought setp program does that for you?!! Check the Add/Remove programs in the control panel after you install your app. Otherwise why would you make a setup?!!!
Regards
|
|
|
|