|
At first I'm not really sure whether the keychar resulting from pressing enter is "\r". It would be better to check for it inside the KeyDown event handler e.KeyCode == Keys.Enter . This way you will also have your keyboard event handling in one place.
Secondly, are you sure the events are really fired (You may debug it)? Most probably your entering text in some other control, so the keyboard events of your form are only fired, if you set KeyPreview true. Either do this, or much better IMO register the KeyDown event handler to the control that's getting edited.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i am type this
void Form1_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter)
this.webBrowser1.Navigate(this.toolStripTextBox1.Text);
}
0 errors 0 warnings
& nothink hepend
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
|
|
|
|
|
As I said, if you're entering text in some other control (probably the toolStripTextBox1), the keyboard events of your form aren't fired unless you set the KeyPreview property true . So either do this, or much better IMO register the KeyDown event handler to the control that's getting edited (toolStripTextBox1) cause otherwise Navigate will be executed whenever you're pressing enter.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
all what i done its
private void Form1_KeyDown(object sender,KeyEventArgs e)
{
if(e.KeyCode== Keys.Enter)
this.webBrowser1.Navigate(this.toolStripTextBox1.Text);
}
then just swith in properties of textbox
http://b.foto.radikal.ru/0610/87852a0cf72a.gif
& all work thx a lot
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Athlon 64 3500+, Gigabyte GA-K8NXP-9, 2x512 DDR400 Kingston, Inno3d 6200 PCIe, SS2 B2C2 v2.6, HDD := 450gb, Genius 56k int, NEC DVD-RW и мать его Суньмастер 550.
|
|
|
|
|
If the KeyDown event handler is now registered to the ToolStripTextBox you should rename, so its obvious which KeyDown event it handles.
private void ToolStripTextBox1_KeyDown(object sender,KeyEventArgs e)
Also it would be a good idea to give the ToolStripTextBox a more descriptive name e.g. "toolStripTextBoxUrl".
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hello, everyone.
I make a program, which uses Serial port (COM1).
I'm working with VS 2005.
My problem is:
Is there any way or method to find out, if the COM1 port is already used from another application before i start my program?
Thanks a lot.
Please answer me to
t_nedelchev@abv.bg
t_nedelchev@abv.bg
|
|
|
|
|
AFAIK there's no other way than trying to open the serial port.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Im making a WinForm GUI for a program that run in the command shell. The problem is that shell program has problems if the input arguments have spaces because after each space it thinks its a new argument. For example:
abc.exe D:\My Documents\myfile.xml
will give an error like Error: invalid command line argument: 'D:\My'
It will work if i use:
abc.exe D:\MyDocu~1\myfile.xml ok
So my question is that how can i get the old style "MyDocu~1" or from an OpenFileDialog.FileName that has "D:\My Documents\myfile.xml". I dont know the name of the style so i called it "old style"
The shell program has an output argument that will send the resulting file to that directory but i will have the same problem as the input file. I just may have to use the OpenFileDialog with File.Copy to copy the file to my program's directory and move with File.Move the resulting file to the same directory as the input file using the file path from the OpenFileDialog.
modified 16-May-21 21:01pm.
|
|
|
|
|
I'm not sure whether the so calles old style is the proper way to deal with white spaces. If I recall right its purpose was to deal with names consisting of more than 8 characters. From what In know you deal with white spaces by putting the path between double quotes:
abc.exe "D:\My Documents\myfile.xml"
Try if your shell program recognizes the file this way and if so simply prepend and append a double quote character to the OpenFileDialog.FileName.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Wrap your path in double quotes and it should work
abc.exe "D:\My Documents\myfile.xml"
|
|
|
|
|
Hi, I have two datagridviews A and B. I want to set the bindingsource filter of datagrid B with the "Selected Row" of datagrid A. E.g. The customer name is in A, and the corresponding orders of that customer will show up in B.
Usually this would be done with the following code if I was using a ComboBox for A:
this.myBindingSource.Filter = "Name=" + myComboBox.SelectedValue;
But for a datagrid view all i can get is "myGridViewA.SelectedRows". How do I extract the selected row and the corresponding column value (Name) from SelectedRows?
A even better method would be how would this be done if Multi select is turned in datagridview A?
|
|
|
|
|
Just googling your question returned answers to your question. Try this site.[^]
A word of warning, I do not think you can have a master/slave relationship with multi select. But you can find out by trying.
|
|
|
|
|
i have been trying to add a Onclick event to this control throught Dispatch ID 0, entry point in an application, but that wont respond.what i intend to do is to get the html tag that generate the event,like a hyperlink or something, and through that get its id and all the attributes. can anyone help. anyother suggestion will be appreciated.
|
|
|
|
|
Hi,
I have a code fragment that handles dragging and dropping tree view nodes on each other, all in the same tree view.
All works fine, but i want to cancel the dragging operation when two mouse button are presses.
In MSDN is written:
"The QueryContinueDrag event occurs during a drag-and-drop operation and allows the drag source to determine whether the drag-and-drop operation should be canceled. A QueryContinueDragEventArgs specifies whether and how the drag-and-drop operation should proceed, whether any modifier keys are pressed, and whether the user has pressed the ESC key."
Well i put a break point in this event, but in runtime when i press on another button or press another key - nothing happened - that is - i execution does not reach the breakpoint.
I search over the internet, but NADA.
Any help will be appreciated.
elaj.
|
|
|
|
|
Please forgive what might seem to be a bit of spam, but I think this would be of interest to the folks here.
I recently published a book outlining the life of a Wall Street programmer, and everything you need to know to get a job as a programmer on Wall Street.
I have some free sample chapters here:
http://www.wallstreetprogramming.com
- Cheers
- Andrey
|
|
|
|
|
how can we fech data in an string array directly from dataset
dataset --> dataset11
table --> searchOnline
column --> url
string[] --> urlString
i want to directly get all the rows in column url came into the urlString
thanks
|
|
|
|
|
i tried this but it wont helped
<br />
url = new string[(dataSet11.SearchOnline.urlColumn.ExtendedProperties.Count)];<br />
dataSet11.SearchOnline.urlColumn.ExtendedProperties.CopyTo(url, 0);<br />
|
|
|
|
|
<br />
url = new string[dataSet11.SearchOnline.Rows.Count];<br />
name = new string[dataSet11.SearchOnline.Rows.Count];<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count ; i++)<br />
{<br />
name[i] = dataSet11.SearchOnline.Rows[i]["name"].ToString();<br />
url[i] = dataSet11.SearchOnline.Rows[i]["url"].ToString();<br />
}<br />
if i write the code as above
name and url array contains same data of url Column
else
if i write it like this then they both contains data from name column
<br />
url = new string[dataSet11.SearchOnline.Rows.Count];<br />
name = new string[dataSet11.SearchOnline.Rows.Count];<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count ; i++)<br />
{<br />
url[i] = dataSet11.SearchOnline.Rows[i]["url"].ToString();<br />
name[i] = dataSet11.SearchOnline.Rows[i]["name"].ToString();<br />
}<br />
please help me it is a true bug or its my mistake ???
|
|
|
|
|
<br />
url = new string[dataSet11.SearchOnline.Rows.Count];<br />
name = new string[dataSet11.SearchOnline.Rows.Count];<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count ; i++)<br />
{<br />
name[i] = dataSet11.SearchOnline.Rows[i]["name"].ToString();<br />
}<br />
for (int i = 0; i < dataSet11.SearchOnline.Rows.Count; i++)<br />
{<br />
url[i] = dataSet11.SearchOnline.Rows[i]["url"].ToString();<br />
}<br />
this solved the problem
but will you please tell me what is the concept behind this
|
|
|
|
|
I have posted my broblem in several place.. No replys that fixed anything.
I am not sure how this began BUT I have it on several computers I have. Three running XP home, One XP Media, and One running Linux and XP Pro (which crashed!) so it is sitting in the corner! My only thought is I have a bluetooth dongle from LINK-SYSTEMS (not blaiming them) A DBT-120 that loaded a Toshiba stack. Nothing wrong with it but I wanted to use the the Microsoft stack.
Anyway, ..
Using
// Reference registry hive.
Microsoft.Win32.RegistryKey hklm = Microsoft.Win32.Registry.LocalMachine;
Microsoft.Win32.RegistryKey myportsregKey = hklm.CreateSubKey("Hardware\\Devicemap\\Serialcomm\\");
Used to return my bluetooth port COM: ports. The string returns a garbage character at the end of the COM?? string.
I'm using something like
//Display value names found in registry
foreach (String valueName in myportsregKey.GetValueNames())
{
String toport;
//////////////////////////////
// THIS string is returned OK
toport = valueName;
toport += " .. "; // just a separator
// Display ports data found in resistry
// Note that I have seen the extra character as a number.
// Example" PORT8 will display as PORT81.. Or some strange character
// It really screws you up trying to open port 81 when it's really port 8!
// String for my bluetooth ports are returned corrupted
toport += myportsregKey.GetValue(valueName);
portList.Items.Add(toport);
}
YES! I KNOW YOU FOLKS CAN DO BETTER! NOT ME!
Anyway, if I use regedit I can type anything I want into the REG_SZ and it will return as I typed it. BUT, if I reboot and try this I get the extra character after the COMM port.
I assume the registry is written to updating the serial ports.
I WOULD SURE LIKE TO SOLVE THIS.
Reinstalling everything on my computers IS NOT A OPTION!
|
|
|
|
|
Hi guys, i'm executing a console application using :
<br />
Process prsAlgorithm = new Process();<br />
<br />
prsAlgorithm.StartInfo.WindowStyle = ProcessWindowStyle.Normal;<br />
prsAlgorithm.StartInfo.FileName = "Lottery.exe";<br />
prsAlgorithm.StartInfo.UseShellExecute = false;<br />
prsAlgorithm.StartInfo.RedirectStandardInput = true;<br />
prsAlgorithm.StartInfo.RedirectStandardOutput = true;<br />
<br />
prsAlgorithm.Start();<br />
<br />
System.IO.StreamWriter swWriter = prsAlgorithm.StandardInput;<br />
<br />
System.IO.StreamReader srReader = prsAlgorithm.StandardOutput;<br />
<br />
swWriter.WriteLine(m_strArgList);<br />
<br />
swWriter.Close();<br />
<br />
<br />
<br />
prsAlgorithm.WaitForExit();<br />
i need to redirect the output of this console application to a textbox on a window form,
but the problem is that i want that every line written in the console application, would be automaticaly written to the textbox (and not wait until the console application has exited)...
i'm pretty sure it has something to do with asynchronousy reading a stream or something like that...?
any suggestions?
Thanks in advance,
Erik.
|
|
|
|
|
....
System.Diagnostics.Process pr = new System.Diagnostics.Process();
pr.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
pr.StartInfo.FileName = "cmd.exe";
pr.StartInfo.UseShellExecute = false;
pr.StartInfo.RedirectStandardInput = true;
pr.StartInfo.RedirectStandardOutput = true;
pr.Start();
pr.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(pr_OutputDataReceived);
pr.BeginOutputReadLine();
System.IO.StreamWriter swWriter = pr.StandardInput;
swWriter.WriteLine("echo SomeTextHere\n");
swWriter.Flush();
....
void pr_OutputDataReceived(object sender, System.Diagnostics.DataReceivedEventArgs e)
{
MessageBox.Show(e.Data);
}
UMS
|
|
|
|
|
Have a look at this[^] article, it does exactly that.
|
|
|
|
|
Is it possible to format only a few datagridview cells? Please help, thanks!
|
|
|
|
|
I'm not sure of the extent of formatting you plan on doing...but here is what I've done:
private void RowPrePaint( object sender, DataGridViewRowPrePaintEventArgs e )
{
if ( ( ( DataGridView )sender ).Name.StartsWith( "detail" ) )
return;
DataGridViewCell cell = viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "BatchSelectColumn" ];
bool ThisRowSelected = false;
if (cell.Value != null)
{
ThisRowSelected = cell.Value == DBNull.Value ? false : (bool)cell.Value;
}
ElementState rowState = states[ new Guid(viewer.BatchGrid.Rows[e.RowIndex].Cells["batchGuid"].Value.ToString()) ];
if ( rowState.InvalidDate)
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dateReceived" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dateReceived" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( rowState.OutOfSequence )
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "batchNumber" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "batchNumber" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( rowState.AmountOutOfBalance )
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dollarAmount" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "dollarAmount" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( rowState.CountOutOfBalance )
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "formCount" ].Style.BackColor = Color.LightCoral;
else
viewer.BatchGrid.Rows[ e.RowIndex ].Cells[ "formCount" ].Style.BackColor =
ThisRowSelected ? Color.LightSteelBlue : SystemColors.Info;
if ( ThisRowSelected )
viewer.BatchGrid.Rows[ e.RowIndex ].DefaultCellStyle.BackColor = Color.LightSteelBlue;
else
viewer.BatchGrid.Rows[ e.RowIndex ].DefaultCellStyle.BackColor = SystemColors.Info;
}
|
|
|
|