|
Hello, good people!
How can I print PDF files from C# code?
What components are required for this task? Are there any free solutions?
Thanks a lot!
|
|
|
|
|
hmm you could use an pdf printer? just an idea, i'm not sure if it is possible
Stef
|
|
|
|
|
Hi,
assuming the PDF extension is associated to a program that can open and print PDF files,
you could use Process.Start() with a ProcessStartInfo.Verb="Print".
|
|
|
|
|
Dear All.
I want to store my data(username and password) in SQL using c#. I want to encrypt the password using C# cryptography. I want to store this encrypted password in database. How? Later I want to decrypt the password while reteriving it from database.
Actually what happens in real time ? How they store password ? Can any one clear my doubt ?
Thanx,
|
|
|
|
|
Mr Perfect wrote: I want to encrypt the password using C# cryptography
Then have a look here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
the plaintex(text to encrypt) will be encrypted to some other format,sothat you cant identify the original text.Its called cipher text.And this is the better way to save passwords in the database.
you can retrieve the orginal text by decrypting the cipher text.
You can use any one of the encryption technique.But you need to decrypt that before use
My small attempt...
|
|
|
|
|
Pwd can be stored using any alogorithm u choose MD5,Sha256 or ur own Algorithm. The encrypted values are soterd to maintain privacy. This algorithm are one-way algorithm so can only be encrypted but cannot be decrypted. So next time when pwd is entered . the code behind will generate the same encryted value that will be matched with the db value.
|
|
|
|
|
nide reply!!!
First and the Foremost: FIGHT TO WIN
About Me
|
|
|
|
|
to store encrypted passwords in a database, you can use salted hash technique.
you can find a lot of articles on this topic if you google for 'salted hash'
regards
|
|
|
|
|
hi i am trying to pass a pointer of an instances as a parameter.
anyone know how to do that it keeps saying something about unsafe context
|
|
|
|
|
C# does not have pointers - just references.
As in the case of the last message I have just replied too
<br />
main()<br />
{<br />
Dog d = new Dog();<br />
Cow c = new Cow(d);<br />
}<br />
This would pass in the instance of Dog (d) into the Cow constructor - the Cow constructor would have to be defined to accept it
<br />
Cow(Dog d)<br />
{<br />
}<br />
|
|
|
|
|
....just for the record you can use pointers but there's always a better way to do it when you are dealing solely with managed code....
|
|
|
|
|
To use pointers in C# you need to create an unsafe class, or an unsafe block. There's really no reason to do so, all classes are passed by ref in C# anyhow.
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 )
|
|
|
|
|
But what about value types?
ref and out keywords?
Regards,
Arun Kumar.A
|
|
|
|
|
Have a look at http://www.codeproject.com/dotnet/pointers.asp
|
|
|
|
|
hi i am currently trying to call a function of another class.
(i am not trying to copy the function over i am trying to calling directly to it)
something like:
class main
{
cow cow1= new cow();
dog dog1 = new dog();
}
i am trying to call for lets say a fucntion called moo from the dog's class fucntion within the dog class.
class dog
{
void woof()
{
moo();
}
}
if this was c++ i would have pass the main's instance variable over to both the cow and dog class upon creation but i have no idea how to do this in c# pls help
|
|
|
|
|
There are numerours ways of doing this - you could create a constructor of the Dog class which takes a Cow variable as a parameter - store this within the Dog class and then use that paremeter within the Woof function to call the Moo function.
i.e.
<br />
Dog(Cow cCow)<br />
{<br />
m_Cow = Cow;<br />
}<br />
<br />
void Woof()<br />
{<br />
m_Cow.Moo();<br />
}<br />
Alternativley make the Moo function static and then you call it like this
<br />
void Woof()<br />
{<br />
Cow.Moo();<br />
}<br />
There's probably lots of other ways but those might be the simplest.......
|
|
|
|
|
The best way to do this sort of thing in C# is with delegates ( nicely wrapped function pointers )
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 )
|
|
|
|
|
how about if i need to call back?
like
class rat()
{
cow cow1=new cow()
void moo()
{
}
}
what if i need to call the moo function from inside the cow instance?(one of the function inside cow)
|
|
|
|
|
i tried the delegate however it keep giving me error can help me chk?
class cow<br />
{<br />
delegate void Delegateking();<br />
<br />
moo hihi;<br />
cow()<br />
{<br />
<br />
Delegateking lala = new Delegateking(this.setter);<br />
hihi = new moo(lala);<br />
}<br />
public void setter()<br />
{<br />
Console.WriteLine("power");<br />
}<br />
}<br />
<br />
class moo<br />
{<br />
string data;<br />
delegate void Delegateking();<br />
<br />
public void set(Delegateking lol)<br />
{<br />
lol();<br />
}<br />
}
|
|
|
|
|
Hi at all,
on my Windows Form i have some Controls whose properties need to be changed by another class that is not derived from the Forms class. How can this be achieved? (is it possible at all?)
For example:
public class Form : System.Windows.Forms.Form
{
...
public System.Windows.Forms.ToolStripStatusLabel tlStrpStatusLblState;
...
}
public class PB_OPC
{
public static void OnServerShutdown(string reason)
{
Form.tlStrpStatusLblState.Text = "OPC Server Not Connected";
}
}
I originally thought that would be possible by changing the "modifiers" Attribute to "Public", but it didn't help.
Thanks for your efforts
|
|
|
|
|
try it as "public static",it will work well.
but it's not the best sovlution.
|
|
|
|
|
Hi,
thanks a lot, it really did help, but i truly agree that this isn't the best solution.
What about the programming style in OOP? Is it a bad habit to access a control from a separate class? I just wondered if there's an alternative.
|
|
|
|
|
|
Thanks for the link.
|
|
|
|