|
Hi friends!
How can I create a self-executing file from within a C# application? What exactly I want is that I have a data file incorporating data which can be changed by the user. I want to give an option to the user to create a self-executing file from within my C# application which will contain that data file and in fact the self-executing file will itself be created with that data file name. One thing to remember - the data file name may change and the data may also change. So the self-executing file must be a flexible system.
Subsequently, one should be able to run this data file through that self-executing file even though my C# application might not be available.
Thanks in advance and regards!!!
|
|
|
|
|
Create your "self executing" program as a standalone program reading its data out of a Win32 resource block.
Now embed this self executing application in your main program. When needed get the executable out of the resource manager, write it to disk with the appropriate name and add the data file to it using the Win32 API to update resource blocks.
Maybe you can also use a standard .NET resource - I never tried, but if it is possible it's probably easier than dealing with Win32 API.
|
|
|
|
|
I have seen so many browsing LDAP applications. However, i can't find a property returned from DirectorySearcher.FindAll() that gives me the user's password ? I have some reason that i need to get into the remote AD to get a particular user name and his/her password. But it seems that I can't easily get it T_T
Please help
|
|
|
|
|
For security reasons it is not possible to retreive the password from the AD.
If youl realy need access to the passwords you would have to write an AD-Plugin that captures password changes (and only changes).
This i a little like replacing the GINA and capturing passwords during login.
And btw. this is faaar away from easliy
/cadi
24 hours is not enough
|
|
|
|
|
Tee+ wrote:
But it seems that I can't easily get it T_T
You can't get it at all! No directory service, worth anything anyway, will ever tell you what the users password is.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Png images file has got multilevel property.
So i can create by a graphic application like Photoshop a png like this.
Now I need to load that (a multilevel png file) within my application all levels and set them in separate bitmap (every level in a new single level png).
How can i do?
Please help me, tnx.
|
|
|
|
|
Can I access all IO ports in C#?
(the Parallel port and the Serial Port)
Can I set each pin on and off in c#?
How?
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
I havn't experiented with LPT but with Serial there is only one DATA+ pin and DATA- pin.
For example:
<br />
SerialPort comPort = new SerialPort("COM1");<br />
comPort.Open();<br />
for (int i=0; i<1; i=0){<br />
comPort.Write("1");
}<br />
comPort.Close();<br />
I hope this helps a little.
(Use pin 3 & 5)
Here's a diagram of a serial port I scanned:
http://home.bresnan.net/~bcreavis/page2.jpg
|
|
|
|
|
I want to turn every pin on and off.
Is this possible?
Or do I need to make some hardware to do this?
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
|
OK, thanks for letting me know.
The PROgrammer Niklas Ulvinge aka IDK
|
|
|
|
|
I have a C++ dll that opens an image file using GDI+ and gets a thumbnail of the opened image using GetThumbnailImage. I would like the C++ DLL to be able to return a pointer to the Image and then have a custom C# control of mine display it. Does anyone know how I can share this image information between the two languages? (I know I can use C#'s GDI image functions to create the thumbnail also, but the C++ version is much faster).
|
|
|
|
|
You could have the C++ dll return the handle to the image using the GDI+ Bitmap.GetHBitmap(). Your C# control could then get an IntPtr containing the handle to the bitmap and use Image.FromHBitmap() to get the image object back.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Hi
I have three Combo boxes .When the value in first combobox is selected second combo is populated and with the second value the third is pupulated.
i am using event selectedIndexChnged with each combo.
On form Load i am populating the First combo with setting its datasource property. when i set the text feild and value feild the selected index is called where i have code to populate second combobox. but the prolem is i need the selected value but that si not set proprely while the form loads and it gives error. any way to do that.
Thanks
monica
|
|
|
|
|
Gosh, this has been asked a lot lately. If you set the datasource in the first combo all the time, it will reset the selected index. Set it in a if (!IsPostback) block, so that it only gets set the first time through.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
can u pls elaborate a bit more.
|
|
|
|
|
well, the page class has a property, IsPostback. That tells your page if you're viewing for the first time, or not. If you don't use this, and you set the datasource every time you load the page, including postback, you will lose your selected index, because it will revert to the first item of the data source you've just set. SO, when you set the data source and databind, you should first check if the page is being loaded for the first time. IF not, your ViewSate contains the contents of the control, as well as the selected Index, and you don't want to replace that.
if (!IsPostBack)
{
combo1.DataSource = GetDataSource();
combo1.DataBind();
}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i Think i was unable to explain my problem I am making a windows application. i am not changing the datasource of my first combo after the form is loaded. My problem taht first time when i set the datasource property of my first combo then it calls its SelectedIndexChanged where i am having code to populate the second combo by querying for selectedvalueof first combo. and similary for third one.
is any simpler solution which works is there
Thanks
Monica
|
|
|
|
|
monica2k wrote:
I am making a windows application
Oh, OK.
So you're saying that the selected index does not exist when you get a selected index changed event ? Or what ? I think you need to post some code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This Is my Main Combo Code
To populate
public static void PopulateMainCombo( ComboBox Combo, string ConnectionString, string TableName, string TextField, string ValueField, string DefaultValue )
{ Combo.DataSource = null;
string Query="select * from " + TableName;
Query = Query + " order by " + TextField;
Combo.DataSource=DataManager.ConnectingForCombo(ConnectionString,Query,TableName);
Combo.DisplayMember = TextField;
Combo.ValueMember = ValueField;
}
private void cmbMainDiagnosis_SelectedIndexChanged(object sender, System.EventArgs e)
{
bool blnVisible;
blnSubDiagnosis=false;
int intSelectedValue;
intSelectedValue=(int) this.cmbMainDiagnosis.SelectedValue;
cmbSubDiagnosis.Visible=false;
cmbSubSubDiagnosis.Visible=false;
blnVisible=Diagnosis.SetDiagnosisCombos(intSelectedValue,this.cmbSubDiagnosis,"tblsubdiagnosis_mas","strSubDiagnosisDesc","intMainDiagnosisCode","0");
blnSubDiagnosis=blnVisible;
if (blnVisible==true)
{
cmbSubDiagnosis.Visible=true;
}
else
cmbSubDiagnosis.Visible=false;
}
/////////////////////////////////////////////////////////////////////////////
and this is my Second Combo that is cmbsubDiagnosis on change of which my third combo that is cmbSubSubDiagnisis is to be populated.
////////////////////////////////////////////////////////////////////////////
private void cmbSubDiagnosis_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (blnSubDiagnosis==true)
{
bool blnVisible;
int intSelectedValue;
intSelectedValue=(int)this.cmbSubDiagnosis.SelectedValue;
cmbSubSubDiagnosis.Visible=false;
blnVisible=Diagnosis.SetDiagnosisCombos(intSelectedValue,this.cmbSubSubDiagnosis,"tblsubsubdiagnosis_mas","strSubsubDiagnosisDesc","intSubDiagnosisCode","0");
if (blnVisible==true)
{
cmbSubSubDiagnosis.Visible=true;
}
else
cmbSubSubDiagnosis.Visible=false;
}
}
///////////////////////////////////////////////////////////////////////////
and this is the function i use to puplate 2nd and 3 rd combo
///////////////////////////////////////////////////////////////////////////
public static bool SetDiagnosisCombos(int paramDiagnosisCode,ComboBox Combo,string TableName, string TextField, string ValueField, string DefaultValue )
{
String ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["DSN"];
Combo.DataSource = null;
String query = "select * from "+ TableName +" where "+ ValueField + " = " + paramDiagnosisCode;
DataTable Dt = DataManager.ExecuteQuery(ConnectionString, query, TableName );
if (Dt.Rows.Count!=0)
{
Combo.DataSource=Dt;
Combo.DisplayMember = TextField;
Combo.ValueMember = ValueField;
Combo.SelectedIndex = -1;
return true;
}
else
return false;
}
pls i am struggling since morning. Help me out pls. the problem comes at the bold points an exception is thrown which says additional information required
Monica
|
|
|
|
|
And what goes wrong ?
=(int)this.cmbSubDiagnosis.SelectedValue;
Is it possible that selectedValue is a string and you need Convert.ToInt16 instead of the cast ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
yes exactly the problem comes here.
what to do next
|
|
|
|
|
1. Change (int) to Convert.ToInt32( (like I said )
2. Step through the debugger in future to see what's going on when you've got a line that blows up
3. Next time you ask a question, if you know where the code blows up, then give us the code, and either way, tell us what the error is you're getting.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Its Still giving error at the same point and the error is
An unhandled exception of type 'System.InvalidCastException' occurred in mscorlib.dll
Additional information: Specified cast is not valid.
|
|
|
|
|
Step 2 - use the debugger to find why the Value can't cast to a number.
Christian Graus - Microsoft MVP - C++
|
|
|
|