|
hi
im currently workin on a windows applicatin in c#.net........
my requirement is tat iv got a windows form with a simple text box and a OK button on it.....
wen some text is entered into the text box and the OK button is clicked... a new .cs file has to be added to the project's solution...
and this text from the text box has to be inserted into the file.....
tat's it...
could u pls help me out with it...
thanks n regards,
Pavithra..
|
|
|
|
|
There is no direct way of doing this.
IMO it is not possible to add any file to the current solution at runtime, simply because, VS IDE wont allow you add any file even at the Design mode, when you run a project.
You may try adding a .cs file to any other project which is not open. Try opening a .csproj or .vbproj through a Notepad which will give you some idea.
|
|
|
|
|
Hi everyone.
Still working on my CustomGridColumnStyle class.
So far I'm traversing the registry correctly, and I retrieve the correct
exe-file or dll-file that contains icons for a specific filetype.
Only problem is that for instance the icons for .txt files is located in shell32.dll
at index -152, or atleast I believe it's index -152 due to registryvalue: "%SystemRoot%\system32\shell32.dll,-152"
in subkey: "DefaultIcon", and I'm not pointing to that index so I just get the icon for dll-files when I display the txt-files...
For extracting the icon I use Win32.SHGetFileInfo(..), and I'm wondering:
Is there any way of specifying which icon you want extraced? By index perhaps?
hImgSmall = Win32.SHGetFileInfo(filePath, 0, ref shinfo,
(uint)Marshal.SizeOf(shinfo),
Win32.SHGFI_ICON |
Win32.SHGFI_SMALLICON);
I think the Win32.SHGFI_ICON | Win32.SHGFI_SMALLICON points to some kind of index though.
If anyone has any knowledge of Win32.SHGetFileInfo I'd really appreciate some feedback.
-Larantz-
|
|
|
|
|
Found another solution, though I'm still interested in an answer on the above question.
The other solution is to pass other constants to the SHGetFileInfo(..) method so that the
method retrieves icons corresponding to fileextension, and not from the file itself.
I'll just post it incase someone else is having the same problems:
In Win32
public const uint SHGFI_ICON = 0x100;
public const uint SHGFI_LARGEICON = 0x0;
public const uint SHGFI_SMALLICON = 0x1;
public const uint SHGFI_USEFILEATTRIBUTES = 0x10;
public const uint FILE_ATTRIBUTE_NORMAL = 0x80;
public const uint SHGFI_TYPENAME = 0x400;
In myClass
hImgSmall = Win32.SHGetFileInfo(
strAnyfilename,
Win32.FILE_ATTRIBUTE_NORMAL,
ref shinfo,
(uint)Marshal.SizeOf(shinfo),
Win32.SHGFI_USEFILEATTRIBUTES |
Win32.SHGFI_TYPENAME |
Win32.SHGFI_ICON |
Win32.SHGFI_SMALLICON);
-Larantz-
-- modified at 6:55 Wednesday 31st May, 2006
|
|
|
|
|
Hi
I need some help plz.
I want to add controls to my CustomTabPage.
How can I add controls programmatically and adjust the location & size of them within my CustomTabPage class? which is inheriting from TabPage class.
I want to add a bunch of labels.
|
|
|
|
|
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.
|
|
|
|