|
What are your concrete problems? Where are you stuck?
Just providing your task gives the impression that you want us to write the whole code for you, but i don't think this is the case here.?
www.troschuetz.de
|
|
|
|
|
Hello,
how can i add c# application on windows start up.
i dont want to add in start up folder.Is there any othere
way? like yahoo messanger which is not appeared in start up
folder..
|
|
|
|
|
Put a value for it in one of the following folders.
For All users:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
For the current users:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
|
|
|
|
|
How can i add this from c# application?any example
|
|
|
|
|
using Microsoft.Win32;
.....
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey run = hkcu.OpenSubKey("Software\\Microsoft\\Windows\\CurrentUser\\Run");
run.SetValue("MySoftware", "C:\\Path\\To\\Software.exe");
something like that should do the trick.
|
|
|
|
|
using Microsoft.Win32;
string strAssemblyPath;
strAssemblyPath = System.IO.Path.GetDirectoryName(base.Context.Parameters[ASSEMBLYPATH_STATENAME]);
Process.Start(strAssemblyPath+"\\Application.exe");
RegistryKey MainKey;
MainKey=Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths");
RegistryKey ApplicationKey=MainKey.OpenSubKey("Application",true);
ApplicationKey.SetValue("Application.exe",strAssemblyPath+"\\Application.exe");
Check the Above code written in c#. This Code i have written for writting my application path into registry.
And u can add the application to the Start up in another way also.
Check while creating setup u can create a chort cut to the start menu startup folder. that will also run the application.
Arun Kumar Sabat
|
|
|
|
|
Thanks for your replay.
i have another doubt?
how can i hold system shut down process
until user close my c# application properly...
|
|
|
|
|
Hi,
I have two datagrids on a WinForm. I want to keep them synchronized so that when the user scrolls one of them, I can programmatically scroll the other one an equal amount. The datagrid is new to me. How can I do that?
Royce
|
|
|
|
|
If you had searched for answers to your problem first, you may have run across http://www.codeproject.com/script/comments/forums.asp?msg=911474&forumid=1649#xx911474xx[^], which describes the solution to what you're searching for. The fact that this is for a RichTextBox doesn't matter; the same solution works for practically all scrollable controls so long as the controls that they encapsulate handle the standard scrolling messages.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hi,
I'm using C#Express Beta and accordingly the framework 2.0.
I recently realized that my application, when starting has a workingset peak of ~128 MB. I startet wondering a bit because the application didn't yet do anything really usefull.
So I fired up the IDE, created an empty WinForms project and compiled a release build. Please note that I have not added any extra code! Here is what I have figured out:
1. On launching the resulting exe, the TaskManager shows a workingset of ~70 MB.
2. When I minimize the MainForm window the workingset shrinks to ~400 KB.
3. Maximizing the window again results in a workingset of ~1460 KB, which I could live with.
Does anyone have an idea how to go on about this?
BTW.: Is there a way to monitor in detail what and where and how your application is using up the memory? I have a monitor to get information as of what modules are loaded, but is ther a way to figure out of what classes or resources are taking up the space?
Any pointers are highly appreceated.
Thanks in advance,
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
|
|
|
|
|
|
Thanks for your reply. I've downloaded the tool and am now trying to figure out if and how it could help me
Thanks again!
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
|
|
|
|
|
Hi,
How can I use this command in C# ?
Inet.Execute "http://200.100.100.100/econtrol.html", "POST", "P1=t"
Best Regrads
youssef
|
|
|
|
|
What's Inet?
/\ |_ E X E GG
|
|
|
|
|
Inet is a component in VB6 for communicate in HTTP, FTP, HTTPS.
I receive this command in a VB6 project and me I working in c++ or c#
Can you help me for translate this command in C# or C++ ?
Best Regards
youssef
|
|
|
|
|
Using the HttpWebRequest and HttpWebResponse classes.
|
|
|
|
|
|
If you don't want to go the programatic way and if this inet thingie is an exe which accepts command line params:
System.Diagnostics.Process.Start(@"C:\Path\inet.exe", @"http://200.100.100.100/econtrol.html POST P1=t");
|
|
|
|
|
Why this code doesn't working ?
Is it correct ?
using system.net;
System.Net.WebRequest req = null;
System.Net.WebResponse rsp = null;
try
{
req = System.Net.WebRequest.Create("http://200.100.100.100/econtrol.html?P8=t");
req.Method = "POST";
req.Timeout = 5000;
}
catch (Exception ex2)
{
string sErr = "Cannot connect to Internet. " + ex2.Message;
}
youssef
|
|
|
|
|
Hi,
I have the below code which runs after choosing an item from the listbox (choose the first one). Goes to the below item after 5 seconds and then goes to another after 5 sec again... So here is my question: I have a func which I named as process() I want to run this func only once when each item is selected in the listbox? So how can I do that???
Thank you,
Cem Louis
<br />
<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
using System.Data;<br />
using System.Timers;<br />
using System.Threading;<br />
<br />
namespace WindowsApplication14<br />
{<br />
public class Form1 : System.Windows.Forms.Form<br />
{<br />
private System.Windows.Forms.ListBox listBox1;<br />
private System.Windows.Forms.Button button1;<br />
private System.Timers.Timer timerClock = new System.Timers.Timer();<br />
private System.ComponentModel.Container components = null;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
InitializeTimer();<br />
<br />
}<br />
<br />
public void InitializeTimer()<br />
{<br />
this.timerClock.Elapsed += new ElapsedEventHandler(OnTimer);<br />
this.timerClock.Interval = 5000;<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if (components != null) <br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.listBox1 = new System.Windows.Forms.ListBox();<br />
this.button1 = new System.Windows.Forms.Button();<br />
this.SuspendLayout();<br />
this.listBox1.Location = new System.Drawing.Point(8, 8);<br />
this.listBox1.Name = "listBox1";<br />
this.listBox1.Size = new System.Drawing.Size(120, 95);<br />
this.listBox1.TabIndex = 0;<br />
this.button1.Location = new System.Drawing.Point(8, 112);<br />
this.button1.Name = "button1";<br />
this.button1.Size = new System.Drawing.Size(120, 23);<br />
this.button1.TabIndex = 1;<br />
this.button1.Text = "Run";<br />
this.button1.Click += new System.EventHandler(this.button1_Click);<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(136, 142);<br />
this.Controls.Add(this.button1);<br />
this.Controls.Add(this.listBox1);<br />
this.Name = "Form1";<br />
this.Text = "Form1";<br />
this.Load += new System.EventHandler(this.Form1_Load);<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new Form1());<br />
}<br />
<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
listBox1.Items.Add("Arthur");<br />
listBox1.Items.Add("Alex");<br />
listBox1.Items.Add("Amie");<br />
listBox1.Update();<br />
}<br />
<br />
private void OnTimer(object source, ElapsedEventArgs e)<br />
{<br />
this.nextvalue(this.listBox1.SelectedIndex);<br />
}<br />
<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
if(this.listBox1.SelectedItem!=null)<br />
{<br />
this.timerClock.Start();<br />
}<br />
else<br />
{<br />
MessageBox.Show("Select an Item");<br />
}<br />
}<br />
<br />
private void nextvalue(int currentPosition)<br />
{<br />
if(currentPosition+1<=this.listBox1.Items.Count-1)<br />
{<br />
this.listBox1.SetSelected(currentPosition+1,true);<br />
}<br />
else<br />
{<br />
this.timerClock.Stop();<br />
}<br />
}<br />
<br />
private void process()<br />
{<br />
}<br />
}<br />
}<br />
|
|
|
|
|
Add a boolean class member that starts out as false. Whenever the timer event is triggered, check if it's false. If so, set it to true. In the ListBox SelectedIndexChanged event handler (or whatever the event is called that gets called whenever you select a different item from the listbox), set the boolean to false again, thus resetting it and allowing the timer event to run again.
This way, Process() can only run when a different item has been selected. And since the Process() then sets the boolean flag to true, it will only run once.
<br />
bool itemIsInTimer = false;<br />
<br />
private void listbox1_SelectedIndexChanged(object sender, System.EventArgs e)<br />
{<br />
this.itemIsInTimer = false;<br />
}<br />
<br />
private void process()<br />
{<br />
if(!this.itemIsInTimer)<br />
{<br />
this.itemIsInTimer = true;<br />
}<br />
}<br />
|
|
|
|
|
I have the following:
To read an image from the northwing db im doing the following (im using 78 as the current images in the northwind db have 78 bytes of header information):
<br />
ms.Write(img, 78, img.Length-78);<br />
<br />
bmp = null;<br />
bmp = new Bitmap(ms);<br />
Then to write the image to the db:
<br />
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);<br />
<br />
BinaryReader br = new BinaryReader(fs);<br />
<br />
byte[] photo = br.ReadBytes((int)fs.Length);<br />
The problem is I need to add 78 bytes when writing a new image to the db, so that when I read the image its like the others that already exist in the db. Anybody know how to do this?
|
|
|
|
|
You will just have to create a new byte array with the 78 bytes in place, then copy the bytes from the read buffer to the other array.
|
|
|
|
|
I realize that I can override the PaintMethod of the DataGridTextBoxColumn class in order to change the color of cells within a DataGrid.
I'd like to change the colors of individual columns headers also. Does anyone know if that is possible?
How might I do that?
Thanks!
Mark Mokris
|
|
|
|
|
Will you check my article on DatagridFormattings. It may help you out.
Sreejith Nair
|
|
|
|