|
I set Format property of DefaultCellStyle property of an instance of DataGridViewTextBoxColumn to N2 But it doesnt work.
N2 means Numeric 2 digit number (1,254.56 etc)
I aim to create a numeric DataGridViewTextBoxColumn . What can i do else?
|
|
|
|
|
How can i check which users are logged into the network?
marcelw
-- modified at 6:16 Thursday 20th October, 2005
|
|
|
|
|
User don't login to a network, they login to servers. What kind of servers? And from where do you want to determine this information? Client-side or server-side?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Basically I want to check if the user is at the office, logged in at his desk. It will need to be an application running on one machine.
marcelw
|
|
|
|
|
That depends on the server your running this from. Are you talking about checking this in a login script, a web service, web application, insert situation here, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
My problem is as below,
1. I open a window form in .NET
2. place a panel A on the form, where the panel's paint method was overrided
3. on the panel A, I placed a tab control
4. on the tab control, I placed another panel B with overrided paint method.
And I repaint all the two panels A and B (by calling its Refresh() method), but only get the panel A refresh, while panel B has no effect.
Why ???? I have tried method like Update(), invalidate(), validate(),
but all have no effect on panel B.
Thanks
|
|
|
|
|
Hi,
I am using System.IP.Ports namespace to connect to modem from my application.
If I connect to modem(55.6) at 115200 I get message from modem, otherwise(greater or less that 115200) not getting any message from modem.
Can anyone tell me what all setting need to be done using the API for it to accept the connection at other speeds.
Thanks
|
|
|
|
|
hi
I want the C # application that I can receive faxes through the modem system.
But I do not know how to do this. Please help me
email : javad.asadi@yahoo.com
|
|
|
|
|
Hi,
I have the following function that checks a database field for DBNull.Value. If it contains DBNull.Value, the it should return "", otherwise the string.
This is my calling function (objCustomer is an instance of the Customer class):
objCustomer.AddressLine1 = Globals.CheckStringForDBNulls(objDr["Address1"]);
This is my static function:
public static string CheckStringForDBNulls(string strCheckString)
{
if(strCheckString.Trim() == DBNull.Value)
return "";
else
return strCheckString.Trim();
}
Something tells me that my parameter string strCheckString is of the wrong type.
Please can someone help me correct this error/problem that I am having.
Regards.
-- modified at 5:45 Thursday 20th October, 2005
|
|
|
|
|
ma se wrote: objCustomer.AddressLine1 = Globals.CheckStringForDBNulls(objDr["Address1"]);
Try This
ma se wrote: objCustomer.AddressLine1 = Globals.CheckStringForDBNulls(objDr["Address1"].ToString());
======================
ma se wrote: if(strCheckString.Trim() == DBNull.Value)
return "";
else
return strCheckString.Trim();
TRY THIS
ma se wrote: if(Convert.IsDBNull(strCheckString.Trim()))
return "";
else
return strCheckString.Trim();
AMJ (With "Z" Factor)
|
|
|
|
|
|
if(strCheckString.Trim() == DBNull.Value)
return "";
else
return strCheckString.Trim();
======
This can be reduced to ONE LINE IF STATEMENT explore your self and reduce your LOC Cost
AMJ (With "Z" Factor)
|
|
|
|
|
If I were to convert a null value coming from a database to something else, would this be good enough? I do not know to what date I should convert if it contains no values, so I chose 1900/01/01. Any ideas?
public static DateTime CheckDateForDBNulls(DateTime dtCheckDate)
{
if(Convert.IsDBNull(dtCheckDate))
return Convert.ToDateTime("1900/01/01");
else
return Convert.ToDateTime(dtCheckDate);
}
Calling function is:
objCustomer.StartDate = Globals.CheckDateForDBNulls(Convert.ToDateTime(objDr["StartDate"])); // Check for DBNull value
I get a horrible error:
Object cannot be cast from DBNull to other types.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Object cannot be cast from DBNull to other types.
Please can you help again.
-- modified at 7:06 Thursday 20th October, 2005
|
|
|
|
|
objCustomer.StartDate = Globals.CheckDateForDBNulls(Convert.ToDateTime(objDr["StartDate"]));
Instead of implementing this, try this one
objCustomer.StartDate = Globals.CheckDateForDBNulls(objDr["StartDate"].ToString());
==========
In your static function try this
public static DateTime CheckDateForDBNulls(String dtCheckDate)
{
if(Convert.IsDBNull(dtCheckDate) && IsDate(dtCheckDate)==true)
return System.Date.MinValue;
else
return Convert.ToDateTime(dtCheckDate);
}
AMJ (With "Z" Factor)
|
|
|
|
|
objCustomer.StartDate = Globals.CheckDateForDBNulls(Convert.ToDateTime(objDr["StartDate"]));
Instead of implementing this, try this one
objCustomer.StartDate = Globals.CheckDateForDBNulls(objDr["StartDate"].ToString());
==========
In your static function try this
public static DateTime CheckDateForDBNulls(String dtCheckDate)
{
if(Convert.IsDBNull(dtCheckDate) || IsDate(dtCheckDate)==false)
return System.Date.MinValue;
else
return Convert.ToDateTime(dtCheckDate);
}
AMJ (With "Z" Factor)
|
|
|
|
|
As the value can be different types of objects, use the object base class, and check the type of the object:
public static string CheckStringForDBNulls(object strCheckString) {<br />
if (strCheckString is DBNull) {<br />
return string.Empty;<br />
} else {<br />
return ((string)strCheckString).Trim();<br />
}<br />
}
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I tried the following function, but it doesn't want to work:
//*********************************************************************
//
// CheckStringForDBNulls Static Method
//
// The CheckStringForDBNulls method checks if a string contains a value, if not it
// returns DBNull.Value, or the value of the string.
//
//*********************************************************************
public static DBNull CheckStringForDBNulls(string strCheckString)
{
if(strCheckString.Trim() != string.Empty)
return strCheckString.Trim();
else
return DBNull.Value;
}
Could you please let me know what I am doing wrong? This is used to check the parameter being added, if it contains nothing, the make the value DBNull.Value, or use the value of thr string.
Thanks
BRENDAN
-- modified at 5:46 Thursday 20th October, 2005
|
|
|
|
|
the return type of this method is DBNull, so you can only ever return a null value..
i suspect you don't really need a static method to perform this check, and could probably get away with something like this instead :
if(string.IsNullOrEmpty(strCheckString))<br />
object = DBNull.Value;<br />
else<br />
object = strCheckString;
|
|
|
|
|
I want to put this into a function because I have a 20 checks, and the code can get very long.
Please put the above mentioned code in a function.
|
|
|
|
|
I don't know how well it would work but you could try making your method return Object
|
|
|
|
|
This was how I initially had it, I just thought there might be another way. But thanks for your help, I appreciate it!!
|
|
|
|
|
Hi,
During the last days i strugled around with a strange problem.
I need to play an video on a 3D-Object. That doesnt sound that hard. I created an device as common, added some data to the vertex buffer and activated the texture support of the Video Class:
video.TextureReadyToRender += new TextureRenderEventHandler(video_TextureReadyToRender);<br />
video.RenderToTexture(device);
Immediatly after the RenderToTexture call, the TextureReadyToRender Event was fired and I was able to render my desired scene. So far so goo, no problems at all. It works absolut perfectly
But when I want to close my application I'm not able to clean up. Everytime when me (or the framework) wants to call the Dispose() method, an NullReferenceException is throwed.
I googled around a lot but couldn't find an answer. Does someone know perhaps an easy example? I tried to work with the Example from MDX-SDK(Summer2004), but because of the complicated framework structure I wasn't able to figure out too much. Does anyone have the same problem?
|
|
|
|
|
Hi all,
I want to know how can i encrypt the whole XML file, it means that the data inside this file can't be understood with any user if he try to open this file (Ex.112364896fgdf64965)
if anyone know please help me
|
|
|
|
|
Take a look at the System.Security.Cryptography namespace.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
i saw this namespace and i didn't found what i want , it makes only encryption for XMLElements and i want to incrypt the whole file to be in octet stream
Thanks for your help
|
|
|
|