|
Thanks! BoxedApp - good idea
|
|
|
|
|
See this[^] too...
- ns ami -
|
|
|
|
|
Hello!
For security I should not to use any temporary files except single .exe file. DLLs should be embedded in exe file. Would you, please, advice me how can I load DLLs, used in my app, without extracting them run-time?
Thanks!
|
|
|
|
|
The security benefits of doing this are very limited. What are you trying to stop ? People can decompile your code, change it and recompile it, so....
You can't just embedd a dll in an exe. You need to move the code of that dll into your project.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hi , use this ...
ILmerege
I know nothing , I know nothing ...
|
|
|
|
|
If the DLLs aren't going to need to be changed, then you could encode the DLL byte-stream as a base64 string and store it in your Resources section. Then at program startup you could convert the resource into the original byte array and use Assembly.Load to load the DLL from that byte array. Of course, you would need to use the System.Reflection namespace to get access to the members, and this is inherently slower than just adding a reference to your DLL. And there's nothing to stop a cracker from reading the base64 string in your program using .Net Reflector, converting it to a byte array and saving it to a file
Alternatively, you could simply store the classes from the DLLs in your project and build them as a single EXE file
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Thank you! Very useful information! I can not only write DLL as string, but I can crypt it as I want
|
|
|
|
|
Hello,
I have 3 forms and 1 button on each one. (form1, form2, form3)
how to code the buttons to go to each form.
I know basically I have to create instance of form and also show and hide.
but don't really understand.
I tried writing form2 newOne = new Form2();
newOne.show();
this.hide();
I was able to click button from Form1 to Form2 but that was all - even when tried to modify.
I must be not doing something.
thank you
|
|
|
|
|
Sounds like you need to read a beginners book. What you've done, kind of works. But, it's not ideal. Ideally, you have your forms as member variables, and if you want to show one and hide the other, the best way to do that is to make them both controls inside the one form.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Thank you for the information
|
|
|
|
|
Hi,
What would be the best way to parse "tags" in a string? for example if I have a string like
string s = "Hello how are you <someTag>blah blah</someTag> ok thx <someTag2>bye</someTag2>"
And I would like to retrieve the someTag's and someTag2's content... etc?
Suggest me alternatives please..
The thing I want to do is a bit specific but might help to understand:
I have a small mail application and I would like to let the user to do something like this in the body (when composing a new message):
Hello this should be readed by all the reciepents
<bodyfilter contacts="mail1, mail2">But this should be readed only by mail1 and mail2
But I don't want help with sending the message.. just with the tagging thing
|
|
|
|
|
If you put a tag at the beginning and end, then you'd have an XML document you could search. Otherwise, you could use regex to find the text inside specific tags, or basic string mashing.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Hi, I have multiple buttons sharing the same Click Event and I am trying to figure out how to tell which button generated the event. In Visual Basic I do it by assigning a unique value to the tag property of each button when it's created and reading that value from within the event handler like this:
Public Sub btnUserBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUserBtn.Click
dim iBtnTag as integer = DirectCast(sender, Button).Tag
Select Case iBtnTag
Case 0 'Button 0 was clicked, handle it here
Case 1 'Button 1
Case 2 'Etc
Case else 'Unknown button was clicked
End Select
End Sub
The Directcast method doesn't seem to be supported in C# (Visual Studio 2005) so can anyone tell me how it is supposed to be done? Thanks!
~Tim
|
|
|
|
|
DirectCast looks nasty as hell. What happens if sender is not a button ? C# is far nicer.
void button_click(object sender, EventArgs ea)
{
Button btn = sender as Button;
if (btn != null) // if sender was not a Button, it would be null )
{
switch((int)btn.Tag)
{
// etc
}
}
}
although I would use an enum, not just an int, so it's strongly typed, ( how do you know for sure which button is 0 ), OR I would switch on the button itself, that is, if (btn == sendButton) doSend();
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Two ways, same result
1)
Button btn = (Button)sender;
int iBtnTag = btn.Tag;
2) Roll it up as you have in your VB
int iBtnTag = ((Button)sender).Tag;
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
private void Frm_Load(object sender, System.EventArgs e)
{
for (int x = 0; x < 10; x++)
{
Button sb = new Button ()
sb.Size = new Size(17, 17);
sb.Location = new Point(x + 17, x + 17);
sb.Visible = true;
sb.Click += new EventHandler(sb_Click);
Controls.Add (sb);
}
}
private void sb_Click(object sender , System.EventArgs e)
{
Button sb = sender as Button;
Console.WriteLine(sb.Text);
}
P.S : are you asking a VB.NET Question ? if so , please do this at VB.NET Forum ...
to get a closer example to your programing language
I know nothing , I know nothing ...
modified on Friday, June 5, 2009 6:30 PM
|
|
|
|
|
Thank you all for your reply's.
~Tim
|
|
|
|
|
Hi,
I have a [System.Control.RichTextBox][1] (not System.Form.RichTextBox), and I would like look for a specific word, and apply certain decoration on the found phrase. so far, I got
this, but it's not working properly. I am looking for **a list of words**, but the TextPointer are not pointing to the right location.Therefore, all my ranges are incorrect. Any idea to do it better?
thanks,
I do run this in a loop of my words:
startPos = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd).Text.IndexOf(word);
leftPtr = textPointer.GetPositionAtOffset(startPos+1, LogicalDirection.Forward);
Rect leftSelectedRect= textPointer.GetCharacterRect(LogicalDirection.Forward);
rightPtr = textPointer.GetPositionAtOffset((startPos+Word.Length), LogicalDirection.Backward);
Rect rightSelectedRect = textPointer.GetCharacterRect(LogicalDirection.Forward);
TextRange myRange = new TextRange(leftPtr, rightPtr);
[1]: http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx
|
|
|
|
|
If you need to clarify something in your original post, then edit your original post, or reply to your original post.
If your problem is so urgent that you feel the need to 'bump' it, then get your wallet out and visit rentacoder.com.
Bumping posts is rude!!!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
You're right, but I didn't know this way I am going to bump it.
|
|
|
|
|
When I want to draw something on a picture box in a Window Form, i use Graphic
Graphics G = pic_Main.CreateGraphics();
G.DrawElipes ...
so on ..
But every thing was cleared when this Form was hidden by another Form or Window .
Any body know how to make it didnt happen .
Thanks !
|
|
|
|
|
magicii wrote: Any body know how to make it didnt happen .
Yes.
1) Don't use a PictureBox. Everyone thinks it is the control to use, because of its name. Only use it for static images (ones that won't change).
2) You can do drawing on the surface of practically any .NET control, including the Form, by handling the Paint event.
Something like:
private void UpdateTableDataForm_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawEllipse(new Pen(this.ForeColor), this.ClientRectangle);
}
This is from a Form.Paint event handler, but you could use a Panel or UserControl , or whatever.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Actually the PictureBox was not a bad choice and in fact if you are going to do a simple animation it is a decent choice. You can draw some background image save it. Load it in the Picture box draw on top of your static image. The real problem, like any other control, is that you drawing on what is essential temporary surface. Every time the control refreshes and redraws itself and your stuff is lost. That is why you hook in to the paint event to redraw your stuff on every refresh but if it is static save the image after you draw it and reload it and it is a null issue. You might have to hook the resize event and redraw it to avoid you image being distorted but it pretty simple too. Hell, I did in VB6 with excellent results.
ARon
|
|
|
|
|
I disagree - a picture box shows static images. If you're doing something more complex, you get more control by handling your own paint event. The real issue is that the OP is using CreateGraphics, instead of handling his paint event. Calling CreateGraphics on a PictureBox ( or handling it's paint event ) is a waste of time, the control never actually is given a picture to show.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
|
|
|
|
|
Christian Graus wrote: you get more control by handling your own paint event.
Agreed. In fact I think I say you have to hook the paint event.
I just say it was not a bad choice.
My previous project, I had a background image with a rail network superimposed drawn from user data which is static during the animation. I drew it in a Picturebox. Used a Picturebox method to save a temp copy of the static train network. I then loaded the image and animated little train traversing the network. All I had to do was update the trains. I got a good framerate with GDI and since I hooked the resize event to redraw the network it always look right. Why does it have to show only static images? Really, if you want to draw stuff, no control is that great. That why there is DirectX and OpenGL.
So what are you disagreeing with? I just saying, there are some case where it might be appropriate. You can treat it like a control for layout purposes, use its native methods, etc...
Like you said.
Henry Minute wrote: You can do drawing on the surface of practically any .NET control
Sorry, Wrong Person.
And yes VB sucks...
Regards,
ARon
|
|
|
|