|
I Have an assembly that has been signed with a strong name key, does anybody know if it is possible to get access to the public key in the assymbly from code within the assyembly.
thanks in advance
william T
|
|
|
|
|
The GetPublicKey method of the AssemblyName class.
static void Main(string[] args) { // get the public key AssemblyName asmName = Assembly.GetExecutingAssembly().GetName(); byte[] publicKey = asmName.GetPublicKey(); // convert the public key to a string StringBuilder builder = new StringBuilder(); Array.ForEach(publicKey, keyByte => builder.Append(keyByte)); // output the results Console.WriteLine("Public Key:"); Console.WriteLine(builder.ToString()); }
|
|
|
|
|
Thank you tgrt for your reply.
All the best
William T
|
|
|
|
|
Hi
There do not appear to be any file attributes for the user who last changed a file and the user who created a file, I can get the date and time though. Does anybody know of any way to get this information in C# or if the information is kept at all?
Thanks
|
|
|
|
|
I don't think that information is kept. Or at least I've never seen it.
My current favourite word is: Bacon!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
As far as I know the information is not kept.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I believe you can get the current owner of the file by using IO classes, may be the owner is the one who created it.
|
|
|
|
|
I have trouble with calling a web method dynamically from a combobox which contains the different operations of a web service. My program can work with different web services navigated by a URL that is specified at runtime. The problem is that, the items of the operation's comboBox are not constant and they change if the web service in use changes, so when writing the code, I don't know the web service method which I want to call, and I want it to be retrieved from the combobox at runtime. If we assume that the web reference to the service is called wrg, I don't know how to call the desired method. I want it to be something like this, wrg."comboBox.Text", but this doesn't work...
What should I do?
I'll be thankful with your help
|
|
|
|
|
You could use a switch block and use that to compare the combobox's text:
switch(comboBox.Text)
{
case "Method1":
Method1();
break;
case "Method2":
Method2();
break;
case "Method3":
Method3();
break;
}
It's quite a few more lines than you where expecting of course, but if it works.
My current favourite word is: Bacon!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Thank you so much for your help, but I think there was a little misunderstanding of my question here, the problem is that as I work with different services with different operations(and the service to work with becomes known at runtime, when I receive the WSDL file of it from the user), so when writing the code, I don't know the operation names which may be called to put them in a switch.
|
|
|
|
|
In that case I don't think I can help, sorry. Maybe someone else will know.
My current favourite word is: Bacon!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hi all,
I am using printDocument as my print function (printDocument.print() ). How can i print paper(more than 1 page) with landscap instead of potrait?
any tips are welcome.
regards
cocoonwls
|
|
|
|
|
|
Hi, Gareth
Thanks for your reply.Yes, i got it. But now i am facing another problem that is it won't print more than 2 page for me.Below is my senario:
I am drawing a chart which using e.graphic.drawline() and some other method.The chart which i draw is over the screen (so, i am using scrollbar to allow user to view the full chart).When printing, it just draw a half of the chart for me (only print 1 page).
Any idea or tips to overcome it?
any tips are welcome.
regards
cocoonwls
|
|
|
|
|
|
Hi, Gareth,
Thank you, I will have a look on that
regards
cocoonwls
|
|
|
|
|
Hi, i have a login form as a child form.
I want to pass the value txtUsername to the parent form. How do i do it?
|
|
|
|
|
There's a great article on this here on CP. Short answer - a delegate.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
If the child form contains this code
public delegate void SendString(string s);
public SendString OnSendString = null;
Then your main form can do this
public void GetString(string theString)
{
}
and in your code that creates the child form:
MyChild dlg = new MyChild();
dlg.OnSendString += new MyChild.SendString(this.GetString);
Then when the child form does this:
if (OnSendString != null) OnSendString("test");
the value "test" is called in GetString in the parent form.
All of this assumes your child form is modeless. If it's modal, then you may as well just assign properties like the other guy said. I assumed that it was modeless from your initial question, you said you want to send something back to the main form. But, if the child form has been closed, then you're not sending anything, properties make more sense in that case.
I can't find the article on communication between forms
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How do i know if my file is modeless or modal?
I did not close my child form. I use .Hide().
I dont know whether i should close the form or use Hide.
probably u might wanna take a look at my file
here is my project file http://opencube.com.sg/EBMS.zip
|
|
|
|
|
If you call ShowDialog, it's modal. IF you call Show, so the parent form stays active, it's modeless, and that's why you need a delegate. If your main form code stops when you show the child, your main form code knows when the otehr form ends it's life, so you can examine it's state. If you called Show, you don't know when the child form has something to tell you, a delegate lets the form tell you.
If you call Hide, then you're calling Show, I guess. Otherwise, your modal form would freeze your application.
A login form has to be modal, or there's no point. A properties form, would be modeless, you change properties and see the results in the main form. Just some examples.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Oh, so inside my FrmMain_Load(), i tried set my childLogin to ShowDialog
i get this error
"Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling showDialog."
private void FrmMain_Load(object sender, EventArgs e)
{
this.toolStripStaff.Visible = false;
this.toolStripCatalogue.Visible = false;
this.toolStripProduct.Visible = false;
this.toolStripOrder.Visible = false;
this.toolStripInventory.Visible = false;
FrmLogin childLogin = new FrmLogin();
childLogin.MdiParent = this;
childLogin.ShowDialog();
stripLblLoginAs.Text = "Login As :";
}
|
|
|
|
|
childForm.ShowDialog(parentForm)
|
|
|
|
|
Yes, you can pass it on the constructor quite often, instead of setting it first. I know you can for a messagebox, for example.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|