|
System.Diagnostics.Process.GetCurrentProcess().Id will return to you the PID of your application instance
|
|
|
|
|
Hi,
I have 2 forms. In the first form I declare a array :
public string[] Name_Menues = new string[10];
Name_Menues[1] = "Mareya" ;
Name_Menues[2] = "Mareya1";
Name_Menues[3] = "Mareya2";
Now I wana to show the value of this array in form2
messagebox.show(Name_Menues[1]);
But when I run it there is some problem and i think i use a wrong code.
please say what should I do??????
|
|
|
|
|
Alireza3839 wrote: But when I run it there is some problem
What exactly is "some problem"? It's hard to say what's wrong without any kind of error message.
If the array was not available in that scope, the code would not even compile, so you would not be able to run it at all. What are you doing to make the array available in the second form? Are you passing the array along in any way, or are you just creating another array with the same name, hoping that it would become the same array?
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: or are you just creating another array with the same name, hoping that it would become the same array?
You are so used to this, ain't you
|
|
|
|
|
Well, it says public doesn't it?
|
|
|
|
|
I have notice that the default members and properties in resource.resx file is internal in VS2005 by microsoft and there isn't any property that allows a resource file to be declared as public uncless declared explicitly. Is there anyway to set/change the behaviour of the resource file from internal to public class Resource1 {} and all it's members to be public as well whenever they are added. I couldn't figure it out can somebody help me in it.
Thanks
|
|
|
|
|
Hi there!
I want to save an encrypted password in a database in order to authenticate the users of my application (on C# 2.0).
So, I encrypted the password provided by the user, as following:
UnicodeEncoding unicodeEncoding = new UnicodeEncoding();<br />
byte[] passwordArray = unicodeEncoding.GetBytes(password);<br />
SHA1Managed sha1Managed = new SHA1Managed();<br />
byte[] encryptedPassword = sha1Managed.ComputeHash(passwordArray);
Then, I saved the password in 'varbinary(160)' field in a table of database (SQL Server 2005):
DataSet.Users.AddUsersRow(userName, encryptedPassword);<br />
UsersTableAdapter userTableAdapter = new UsersTableAdapter();<br />
userTableAdapter.Update(DataSet.Users);
How can I recover this encrypted password in order to compare it with a new encrypted password provided by the user?
This code:
byte[] passwordArray = row["Password"];
doesn't compile because "it can't convert object to byte[]".
Thank you, in advance.
--
Adrián Córdoba
|
|
|
|
|
Try casting it first:
byte[] passwordArray = (byte[])row["Password"];
|
|
|
|
|
Thank you very, very much!
--
Adrián Córdoba
|
|
|
|
|
In VS 2003 I used SBCollectionGenerator to auto-generate strongly-typed collections from .xml files. In VS 2005 the base classes and some interfaces are no longer accessible. Is there a work around or a new tool for VS 2005?
Thanks for help
|
|
|
|
|
|
hi how can i disable alt+f4 key please give me some clue if possible please send some sample
code in c#.
|
|
|
|
|
You might be able to with a system wide keyboard hook. Also, doesn't that close a program ? The onclosing event might be useful, you could write code to refuse to close, unless some condition is met ( such as, ALT is not held down )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Yeah, that's what I'd suggest.
private bool closeok = false ;
private void button1_Click ( object sender , System.EventArgs e )
{
this.closeok = true ;
this.Close() ;
}
private void Form1_FormClosing ( object sender , System.Windows.Forms.FormClosingEventArgs e )
{
e.Cancel = !closeok ;
}
The form will only close due to a click of button1.
(In addition, if you haven't already, set the form's ControlBox = false; )
|
|
|
|
|
Does anybody know of any way to find out which application/process has locked a file?
As an example, you have a file called widgets.txt and when you try and delete it you get a message along the lines of "Cannot delete widgets.txt, there has been a sharing violation, the source or destination file may be in use". The problem is this message doesnt tell you what it actually holding a handle on the file.
I am currently working under the assumption that there is something in the Win API that I can call to get this information, however I am currently at a loss to what it is.
|
|
|
|
|
|
How is it possible to create and populate an array for the follwing data please?:
Please note that this is just a sample data
AL LME BR IPE CU LME EURUSD
BR IPE 1.0 23 98
CU LME 3 1.0 8
EURUSD 2 76 1.0
|
|
|
|
|
Well, assuming the first row is headers, I'd create a struct that defines the collection of data in each row, so looks like two strings, and three floats, and then make an array of that type.
I'd use the List class, rather than an array.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have a DataGrid dbgTest with DataSource = dtA
i use DataView to search some row and display result in dbgTest
anythings are work well.
and my problems is: i want create new DataTable from result display in dbgTest after search by DataView.
Thanks
|
|
|
|
|
I have created an Windows.NET app in C#. with crystal reports.
These all run fine on my development computer. I modified my setup project to
include all the merge modules that CR.NET needs, added the
licence key info. and rebuilt the solution. still everything works fine when
I run the installation. both on Development computer as well as on Client
computer.
later i added an installer class to add the Database path to a config file
during installation
I successfully installed the app. on my development computer.
but when I try to run it on Client system, I receive the following error:
Unable to get installer types in the <app path="">\app.exe assembly --> one or
more of the types in the assembly unable to load.
it seems to be something related to crystal reports.
I am using .NET Studio 2005 and app is on c# with few crystal Reports.
Now if i copy and paste the bin/debug directory from the development system
to my client system, it gives the following error when trying to run crystal
report module:
File or assembly name CrystalDecision.Windows.Forms, or one of its
dependencies, was not found
help appreciated.
thanks in advance.
Rachit Damani.
|
|
|
|
|
(I know you said that you have all the merge modules so just make believe I'm the person looking over your shoulder with coffee breath offering useless advice...)
Under Detected Dependencies is CrystalReportsRedist2005_x86.msn listed? What I would do just for testing is to see if you can build an installer just for the Crystal Reports Redistributable and another for your main app (without the Crystal Reports). If that works then something went goofy in your original installer project (I have to make new ones all the time. For some reason mine get corrupted when I have a new version of the main exe).
Good Luck!
|
|
|
|
|
Dear friends,
Let say I have a connection from C# 2005 to MS Access database and table name "personal", and dataset name "myDataSet". How can I delete a current row record from that dataset also in access database?
Thanks in advise...
memix
|
|
|
|
|
|
Hello...how can I convert an element from a list into double or integer....I have something like this.......:
totalDemand += Convert.ToDouble(this[j].Demands, CultureInfo.CurrentCulture);
and it gives me an "unable to cast object of type System.Collections.Generic.List'1[system.Double]' to type System.IConvertible'.
and totalDemand it's declared like this:
private double totalDemand;
public double TotalDemand
{
set
{
totalDemand = value;
}
get
{
return totalDemand;
}
}
|
|
|
|