Just a quick question but is it possible to open a helpProvider?
All I want is open a CHM help file when I click a button in addition to the F1 key?
If it’s not possibly anyone know of a work around?
Thanks Peter
I think you mean a Windows Forms Application.
There is a Windows Forms Control called HelpProvider that does it for you.
System.Windows.Forms.HelpProvider hlpProvider = new System.Windows.Forms.HelpProvider();
hlpProvider.SetShowHelp(this, true);
// Help file
hlpProvider.HelpNamespace = "helpFile.chm";
You can open your help file with
Process proc = new Process();
proc.StartInfo.FileName = "helpFile.cfm";
proc.Start();
private void MainMenu_Load(object sender, EventArgs e)
{
helpProvider1.HelpNamespace = Application.StartupPath + "\\filename.chm";
helpProvider1.SetShowHelp(this, true);
}
private void HelpText_Click(object sender, EventArgs e)
{
Help.ShowHelp(this, helpProvider1.HelpNamespace);
}
Good luck ^_^
Related
Morning all,
I have a c# app where if you press a start button a dialog box will open and the OK button will be automatically pressed. The problem is I don't know how to do this.
The code is below:
private void Start_Click(object sender, EventArgs e)
{
if (captureDevice.ShowDialog(this) == DialogResult.OK)
{
var videoSource = captureDevice.VideoDevice;
FinalVideo = captureDevice.VideoDevice;
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
FinalVideo.Start();
}
}
I have tried:
Removing the if statement to directly run whats inside it
Put DialogResult.OK = true before the if statement
CaptureDevice.DialogResult.OK = true before the if statement;
Image shows the dialogbox when start is pressed
This dialog let you select the source capturing device. If you want to bypass this dialog you should specify source device in your code. if you use AForge.Net this link help you. if not search for appropriate solution in documentation of component or library you use.
Add a new button to your form. Call it "Settings". In the event handler for this button, you roughly put the first half of what you have now for the Start button. Create a Settings object in your MainForm in which you will store the camera chosen.
private void Settings_Click(object sender, EventArgs e)
{
if (captureDevice.ShowDialog(this) == DialogResult.OK)
{
settings.VideoSource = captureDevice.VideoDevice;
}
}
private void Start_Click(object sender, EventArgs e)
{
FinalVideo = settings.VideoSource;
FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
FinalVideo.Start();
}
Hope this helps.
I have sort of found a solution to the question and it was to use:
SendKeys.Send("{ENTER}");
I used it before the if statement and it works with the Start_Click method but when i use it in a method called Start_Vid(), I get the error:
'SendKeys cannot run inside this application because the application is not handling Windows messages. Either change the application to handle messages, or use the SendKeys.SendWait method'
I have no idea why it should not work and what the error message means so should I be creating another question to have this answered or can it be solved in here do you think?
I am new to programming and stuck on a little thing. I have a button on my Windows application and I want to open Notepad when I click the button. I used all the available codes from internet starting from process.start() to even envirnoment.path but the button doesn't show the Notepad. Here is what I have already tried.
private void btnNotepad_Click(object sender, EventArgs e)
{
string notepadPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86), "notepad.exe");
System.Diagnostics.Process.Start(notepadPath);
}
Or simply:
system.diagnostics.process.start(#"notepad.exe");
Also did this:
string theData = txtbxRepeat.Text;
FileStream aFile = new FileStream("myTextFile.txt", FileMode.OpenOrCreate);
StreamWriter sw = new StreamWriter(aFile);
txtbxRepeat.Text = theData;
sw.WriteLine(theData);
sw.Close();
Please help me in this.
You are heading in the correct direction with the first and 2nd code snippet. However, you need to specify the full path to the notepad++ exe.
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Notepad++", #"notepad++.exe"));
}
However, keep in mind the user may have installed notepad++ in a different directory (for example they don't have an x86 directory).
UPDATED: updated to include environment paths rather than hard-coded path.
With winforms, when I right click on a folder or try to delete a folder within the FolderBrowserDialog the window becomes irresponsive and I've to force-close it.
Here's the code:
private void btnOpenFileDialog_Click(object sender, EventArgs e)
{
folderBrowserDialog1.SelectedPath = txtBoxLog.Text;
folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
if (folderBrowserDialog1.ShowDialog()==DialogResult.OK)
{
txtBoxLog.Text = folderBrowserDialog1.SelectedPath;
}
}
The problem was system wide, so the control was correctly behaving in an incorrect way (irony).
I need create one item in my ToolStripMenuItem with this feature: if I check it, in application is turn on "stay on top" property.
I tryed this code:
private void alwaysOnTopToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
{
if (alwaysOnTopToolStripMenuItem.Checked)
fForm1.TopMost = true;
else
{
fForm1.TopMost = false;
}
}
but I get this error in Visual Studio 2010 (Windows Form)
I dont know how I can solve this strage issue. Thanks in advance.
assuming the click handler lives in the form:
this.TopMost = alwaysOnTopToolStripMenuItem.Checked;
I want to open folder from web page by clicking on a button ...
In my code when I am use a hyper link its working properly.
but when I am using a button its not working.
here is my code:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("file://LAP6//C$");
}
Can you provide me some C# code for this functionality.
Thanks
If you simply want to open some folder then you can try this way:
protected void Button1_Click(object sender, EventArgs e)
{
System.Diagnostics.ProcessStartInfo processInfo = new System.Diagnostics.ProcessStartInfo();
processInfo.FileName = "explorer.exe";
processInfo.Arguments = Server.MapPath("YourFolderName");
Response.Write(processInfo.Arguments.ToString());
System.Diagnostics.Process.Start(processInfo);
}
Reply me if it works for you.