|
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;
}
|
|
|
|
|
Hi
what we write in c#
int a;
int *p=&a;
|
|
|
|
|
You can use pointers in C#, but only in code blocks marked unsafe. Usually you use references.
As an int is not a reference type, you have to box it as an object to get a reference to it:
int a = 42;<br />
object r = a;
To get the integer value back from the object, you cast it:
int b = (int)r;
Note that boxing is much less efficient than working with the plain value types directly, as an object has to be created to contain the value.
---
b { font-weight: normal; }
|
|
|
|
|
int a;
int *p=&a
Not sure. But think it is unsafe code, As I remember it worked in the old Bell Labs 'C'.
Sorry, I just had to.. No hate here.. Just sort of 'funnin' ya!
|
|
|
|
|
unsafe
{
int a;
int *p = &a;
}
Compile with /unsafe
|
|
|
|
|
Hi im a beginner and in need of some help.
im tryin to create a simple Aplication,in which i am using 2 tetbox.In the edit menu I am using ctrl+c and ctrl+v as shortcut for copy and paste. But
ctrl+c and ctrl+v are not working inside the individual TextBoxes
Please help.
Thanks
Rajmohan
|
|
|
|
|
you don't need to write any code for this ctrl-c ctrl-x and ctrl-v...
|
|
|
|
|
there is shortcut property of textbot use it dear
|
|
|
|
|
actually I gonna write a program in CSS,my Question is,how can I make a list with 4 folders with the same image, and with a subfolder with different image, all in one list?
You30
|
|
|
|
|
I don't think that cascading style sheets is the best tool for writing programs...
What kind of folders and images are you talking about, and what has this to do with inheritance?
---
b { font-weight: normal; }
|
|
|
|
|
Hi im a beginner and in need of some help.
im tryin to create a simple chat program like mIRC.
Could someone just explain the concept of how it flows.
I have an idea but not sure if thats how it is.
I have a server-side app, and a client-side app connecting to the server. does the message the client types just get sent to the server and then the server sends the message to all connected clients? how do i go about creating handles for each client connecting to my server?
Please help.
Thanks
|
|
|
|