|
This question is far to vague. What database are you using (SQL Server, Firebird, MySQL)? What version of the .NET Framework?
You have to supply more detailed information.
|
|
|
|
|
I am esigning a usercontrol with a panel child. Using a ControlDesigner I used EnableDesignMode to make it possible to drop controls in the panel at design time. Now i wanted to lock te panel because you can move and resize the panel inside the usercontrol. I made another ControlDesigner class to use on the panel class and override the SelectionRules to set it to locked. If I use this locked thing, the functionality of dropping controls in the panel dissapears. Howe can I implement these two things without problems?
My code:
<br />
[DesignerAttribute( typeof( AdvancedNoteDesigner ) )]<br />
public partial class AdvancedNote : UserControl<br />
{<br />
...<br />
}<br />
<br />
public class AdvancedNoteContentPanel : Panel<br />
{<br />
public AdvancedNoteContentPanel()<br />
{<br />
this.SetStyle( ControlStyles.AllPaintingInWmPaint , true );<br />
this.SetStyle( ControlStyles.OptimizedDoubleBuffer , true );<br />
this.SetStyle( ControlStyles.ResizeRedraw , true );<br />
this.SetStyle( ControlStyles.SupportsTransparentBackColor , true );<br />
this.SetStyle( ControlStyles.UserPaint , true );<br />
<br />
this.BackColor = Color.Transparent;<br />
}<br />
}<br />
<br />
internal class AdvancedNoteDesigner : ControlDesigner<br />
{<br />
public override void Initialize( IComponent component )<br />
{<br />
base.Initialize( component );<br />
<br />
AdvancedNote advancednote = (AdvancedNote)component;<br />
<br />
EnableDesignMode( advancednote.ContentPanelFront , "ContentPanelFront" );<br />
EnableDesignMode( advancednote.ContentPanelBack , "ContentPanelBack" );<br />
}<br />
}<br />
<br />
internal class AdvancedNoteContentPanelDesigner : ControlDesigner<br />
{<br />
public override SelectionRules SelectionRules<br />
{<br />
get<br />
{<br />
SelectionRules selRules = base.SelectionRules;<br />
<br />
selRules = SelectionRules.Locked;<br />
<br />
return selRules;<br />
}<br />
}<br />
}<br />
<br />
|
|
|
|
|
i have used System.Diagnostics.Process.Start("explorer.exe", "/e,/select,c:");
for Opening My Computer. it works. but i want to open My Doc, My Network place also. how it possible?
Thanks.
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
You should just be able to put "My Documents" in the arguments list and it should work fine.
So the code is:
System.Diagnostics.Process.Start("explorer.exe", "My Documents");
Hope that helps.
Ben
|
|
|
|
|
You can use the following to get that path:
<br />
string myComputerFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);<br />
You can then use that information to shell to it ...
|
|
|
|
|
hi
i want to run exe file(s) in buffer,How to do ..thanks(pe,injection,...)
Description :
my exe is Encrypted and exist in CD-drive and when user start my program, it check information of that computer and cd ... then Decrypt that exe in ram and run it from ram (on the fly),without extract on disc. but ho to do ?
|
|
|
|
|
ALL executables that you write run in RAM. You don't need to run from a disk because you can use AutoRun (assuming that it is enabled) to run the application from the CD. If you're looking to see how you can inject a virus/worm onto the client machine then you've come to the wrong place.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I think that he's aiming for is an exe that is encrypted so it can't be decompiled.
After decompiling the app he doesn't want to cache it to disk so Process.Start wont work.
|
|
|
|
|
The principle's still the same. In order to run the application, you would have an encrypted app which you would then fire off using another application. This other application would be responsible for decrypting the application and starting it off. The hint is that you could decrypt the encrypted exe to a stream and then use Assembly.Load to load the executable.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I was thinking that it could be any application, not just a .Net one.
|
|
|
|
|
But, this is the C# forum. If it's not .NET then he's in the wrong forum
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The way I read it was that he wants to make a C# app that can decrypt and execute any application without writing it to disk.
Of course this is all assumption built on lack of information hehe :P
|
|
|
|
|
Hi,
I'm trying to update a property on an arraylist of visual components on a form, getting the property value to set by calling a method on another object. However, performance is unacceptably slow.
public delegate void VisualComponentUpdateHandler(VisualComponent v, int val);<br />
public void VisualComponentUpdate(VisualComponent v, int val)<br />
{<br />
v.Value = val;<br />
}
and running in a seperate thread:
<br />
VisualComponentUpdateHandler d = new VisualComponentUpdateHandler(VisualComponentUpdate);<br />
int val;<br />
while (true)<br />
{<br />
foreach (VisualComponent v in visualComponentArrayList)<br />
{<br />
val = sourceObject.GetValue(Convert.ToInt32(v.Name));<br />
d.Invoke(v, val)<br />
}<br />
Thread.Sleep(100);<br />
}
I added the Thread.Sleep(100) because without it, the visuals don't seem to update.
I've got anything up to 128 of the visual components to update - they're custom components derived from ProgressBar, displaying a measurement which is obtained from a program running on a seperate machine which passes a new sourceObject every 250ms to the program via .NET remoting (this updating mechanism runs in another thread and doesn't seem to be affected by the slowdown in response which occurs when the property update thread is running).
|
|
|
|
|
Hi,
Might be a stupid questions, but.. Why are you doing d.Invoke(v, val) ? Shouldn't it be v.Invoke(d, new object[]... or something like that? You are attempting to marshall back to the gui thread to update your control right? I think Delegate.Invoke would spawn yet another thread , where it may not be safe to update GUI Controls (which might explain why you need a sleep to make it work)
Bijesh
--------------------------------------------------
|
|
|
|
|
Yes, sorry - I made a typo. It does work; it's just that it renders the GUI too unresponsive. I'm looking for smooth-ish updating on all of the controls and looping through them (even with Thread.Sleep in there) seems to result in massive CPU load and sluggish display. Perhaps it is something to do with the way in which the thread which performs the invoke calls back to the GUI thread obtains the values to set the component properties to (it's not too bad if I just generate some numbers within the updating thread and use those instead).
Back to the drawing board. Thanks.
|
|
|
|
|
Right, got it. Suspicion confirmed. The object I was calling the method on in order to get the values was being blocked by another thread accessing it. Stick the invokes to update the component properties into the same thread and the problem's gone away. Thanks ;P
|
|
|
|
|
Hello fellows. I need your help. I have a Windows.Forms application which makes a connection to a database about 5 - 10 seconds. While I'm trying to connect to the database, an animated control starts an animation . After the connection is made I stop the animation and want to run another function to fill a DataGrid control.
private void OpenConFunction()
{
//... some code
}
private void AfterConnFunction()
{
//... some code to fill DataGrid control
}
private void myButton_Click(object sender, System.EventArgs e)
{
Thread t = new Thread(new ThreadStart(OpenConFunction));
t.Start();
this.AnimatedControl.Start(); //Suppose AnimatedControl
//has two methods one to start animation and a second one to stop it
}
What has to be the code after OpenConFunction returns? I want to invoke the AfterConnFunction and stop the AnimatedControl animation?
|
|
|
|
|
i would recommend u a simplest way...
call the animation method asynchronously , inside which u have following code
{
this.AnimatedControl.start();
while(!bnFinishedFlag)
{
//do nothing
//bnFinished flag is class level var and will be set to true when db
//operation finishes
}
this.AnimatedControl.stop();
//end the async method call..
}
hope this helps//..
|
|
|
|
|
Thanks for the reply. Unfortunately, your suggestion didn't help me. I think I need to call the OpenConFunction() in a separate thread. But I don't know how to start the AfterConnFunction when OpenConFunction ends.
|
|
|
|
|
I mean when I start the OpenConnFunction() in a separate thread the animation starts otherwise not
|
|
|
|
|
You can do this using Invoke and delegates. In your OpenConFunction method, once you are done openig the connection you can do an
this.BeginInvoke( new AfterConnFunctionDelegate( AfterConnFunction) )
where AfterConnFunctionDelegate is declared as a delegate with the same type as AfterConnFunction.
public delegate void AfterConnFunctionDelegate();
In the AfterConnFunction method you can safely call this.AnimatedControl.Stop()
--------------------------------------------------
|
|
|
|
|
Brilliant!! Thank you
|
|
|
|
|
hi ,
i use c# web services to retrieve data from a provider.
I would like to log incoming and outgoing xml soap messages when i call a method and when a response arrives..
is there a way to do this ?
|
|
|
|
|
|
Hi friends
How to connect a database in c#
thanks in advance
KK
|
|
|
|