|
u can try
Label lbl = new Label();
lbl.Location = new Point(int x,int y);
lbl.BackColor=Color.Red;
tabPage1.Controls.Add(lbl);
rahul
|
|
|
|
|
rcwoods wrote: I want to add a bunch of labels.
Label[] lbl = new Label[3];
for (i = 0; i < 3; i++)
{
lbl[i] = new Label();
lbl[i].Location = new Point(x, y);
tabPage1.Controls.Add(lbl[i]);
y += lbl[i].Height + 10;
}
|
|
|
|
|
Hi there,
We've got a service we've created in our project which is to be installed with serviceinstaller, all goes well and it's installed on the machine but when we try to run the service we get "the ** service on local computer started and then stopped etc". Does anyone know why this is and how to fix it as we need the service to run automatic. I'd come across threads that mentioned trying to set autolog to false, this didnt work, neither did adding a timer to the initialize component to try to force it to stay started for a period of time.
Any help greatly appreciated as this is doing my head in lol
|
|
|
|
|
hi
i want to hide process in task manager .. how to do that ??
|
|
|
|
|
Generally speaking, that can't be done.
There was a music player, I think it came from Sony, that did that a while back by installing some hack in windows that hid certain programs from the task manager. It was widely considered to be a virus, especially as it was quite hard to get rid of.
---
b { font-weight: normal; }
|
|
|
|
|
Does anyone knows how to calculate the Norminv (Excel) function in C# ? This function returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
Thanx a lot ! Joachim.
|
|
|
|
|
private static double inverse(double p)
{
var a = new double[]{-3.969683028665376e+01, 2.209460984245205e+02,
-2.759285104469687e+02, 1.383577518672690e+02,
-3.066479806614716e+01, 2.506628277459239e+00};
var b = new double[]{-5.447609879822406e+01, 1.615858368580409e+02,
-1.556989798598866e+02, 6.680131188771972e+01,
-1.328068155288572e+01 };
var c = new double[]{-7.784894002430293e-03, -3.223964580411365e-01,
-2.400758277161838e+00, -2.549732539343734e+00,
4.374664141464968e+00, 2.938163982698783e+00};
var d = new double[]{7.784695709041462e-03, 3.224671290700398e-01,
2.445134137142996e+00, 3.754408661907416e+00};
var plow = 0.02425;
var phigh = 1 - plow;
if ( p < plow )
{
var q = Math.Sqrt(-2*Math.Log(p));
return (((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
}
if ( phigh < p )
{
var q = Math.Sqrt(-2*Math.Log(1-p));
return -(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
}
var q1 = p - 0.5;
var r = q1*q1;
return (((((a[0]*r+a[1])*r+a[2])*r+a[3])*r+a[4])*r+a[5])*q1 /
(((((b[0]*r+b[1])*r+b[2])*r+b[3])*r+b[4])*r+1);
}
|
|
|
|
|
Hello,
I am having a form application as FrmA. On the button click of FrmA, i display another form FrmB. Now i want to access some variable of FrmA in FrmB.
How it is possible.
Can i get the parent object(FrmA) in FrmB.
Thanks
Gajesh
Pune(India)
|
|
|
|
|
In FormB you must change the constructor:
private FormA formA = null;
public FormB(FormA formA)
{
this.formA = formA;
}
In FormA you must create FormB with this way:
FormB formB = new FormB(this);
You can change the string in formA using:
this.formA.StringToBeChanged = "Hello World Again";
|
|
|
|
|
To access a variable in FormA, that variable should be public. To access the FormA in FormB the following code...consider j is the variable in FormA
FormA frm=new FormA(); // Create Object for FormA
MessageBox.Show(frm.j);
// The Value of the varible j(in FormA will be displayed in FormB)
|
|
|
|
|
Hi,
I have a web service and a web service consumer. Whenever i call the function of the web service, i get exception System.Xml.XmlException with message Character 0x12 is not valid in XmlDocument. I know that characters whose code are under 0x20 are not allowed in XML Documents. Actually i am sending encrypted data to the web service that's why when i encrypt, characters under 0x20 also appear in the XML Document. I have searched the net but could not get the work around. Please help me to solve this problem.
Wasif Ehsan.
|
|
|
|
|
Try after all the encrypting (or even do just that) a Base64 encrypter.
It mainly changes all chars to a-z, A-Z, 0-9, =, [And another one I don't remember], so that you can use that anywhere.
Try it.
|
|
|
|
|
Hi,
How does one check if an item in a listbox is selected? Usually I would do it like this if I have multiple items selected:
foreach (ListItem item in lbFacilities.Items)
{
if (item.Selected)
...code here...
}
Is the best way like this (even if the SelectionMode property is not set to Multiple? Or would the following also be appropriate?
if (lbWineries.SelectedValue == string.Empty)
...code here...
Regards,
ma se
|
|
|
|
|
I think the best way to check for selected items is to use SelectedIndex if the selection mode property is One or SelectedIndices if its multiple.
Regards,
Wasif Ehsan.
|
|
|
|
|
Thanks for the reply.
You mean like (for single selection):
if (lbWineries.SelectedIndex == 0)
Is this right?
|
|
|
|
|
for (int i =0;i<=lbFacilities.Items.Count -1;i++)<br />
{<br />
if (lbFacilities.Items[i].Selected ==true)<br />
...code here...<br />
}
|
|
|
|
|
Is this the correct way to check if a single item is selected? Even if the selectionmode is not set to multiple?
|
|
|
|
|
Hello,
I am developing a VC# application, where I am using unbound DataGridView to input data from users. Here, first cell is for ItemCode and Second Cell is for Item Description, and other cells are for other dataentry which are not of much concern here.
If user Right-Clicks first Cell (Item Code) with entering 'A', then List of ItemCode and corresponding Item Description will be displayed where starting charter is 'A' in other window and user can select any one of them, this selected ItemCode and Description will be displayed in First and Second Cell of DataGridView.
My problem starts here,
1. Even after my setting
DataGridview1.rows[0].cells[0].value = 'Abc'
I am not able to view this new value in the datagridview, instead Old entered value i.e. 'A' remains there.
Does anybody have any solution ?
|
|
|
|
|
Tushar Bhatt wrote: DataGridview1.rows[0].cells[0].value = 'Abc'
Modify it with;
DataGridview1.rows[0].cells[0].value = "Abc";
best regards.
|
|
|
|
|
Thanks for your reply.
But actually I am setting value string using textbox.text, so this solution is not relevant here, problem here is setting up of edit buffer, which I am not getting right.
|
|
|
|
|
Hi,
I am using the following code to decrypt an array of bytes:
DESCryptoServiceProvider des=new DESCryptoServiceProvider();
des.BlockSize=blockSize;
des.Key=kDESKey;
des.KeySize=64;
des.Padding=PaddingMode.PKCS7;
des.Mode=CipherMode.ECB;
ICryptoTransform cryptoTransform=des.CreateDecryptor();
MemoryStream mem=new MemoryStream(cipherTextBytes);
CryptoStream cryptoStream=new CryptoStream(mem,cryptoTransform,CryptoStreamMode.Read);
byte[] outputBuffer=new byte[cipherTextBytes.Length];
cryptoStream.Read(outputBuffer,0,outputBuffer.Length);
mem.Close();
cryptoStream.Close();
return outputBuffer;
But the problem is that when i call Read of the cryptoStream, i get System.Cryptography.CryptographicException with the message of "Bad Data". Basically above code is the part of a web service. I am not concerned with the above code. I just want to provide some security feature to my web service. If it can be done through some other easy way, that's also welcome.
Please guide me in this regard...
Wasif Ehsan.
|
|
|
|
|
Hi
I have a Type object which is of type "System.Int32[]" to "System.Int32". I know theres makearraytype(), but how do I do it the other way?
cheers
|
|
|
|
|
What's the point of merging an array of ints into a single int? That makes little sense.
Tell us what you're trying to achieve
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Well the type wouldn't always be an int. That was an example (sorry if I wasn't too clear). Basically I'm getting the parameter of a function through reflection (which will be an array of some Type t) and then casting an Object array to Type t, which I'm told means I need to convert each item individually.
cheers
|
|
|
|
|