|
OK, so make a copy of your data source, remove the row, and set that as the data source in this instance. Or handle the event that's fired when a row is rendered, and stop it from rendering the first row.
|
|
|
|
|
hi
can u explain more ?? if u can please give me an example .. thanks ..
|
|
|
|
|
If you use the Clone method to copy the data source, you can remove the top row from the copy.
|
|
|
|
|
Hi hdv212.
You can use the row filter property from DataView.
Example:
DataTable dt = new DataTable();<br />
this.categoryTableAdapter.Fill(dt);<br />
dt.DefaultView.RowFilter = "category_id <> 1";
categoryDataGridView.DataSource = dt
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
I currently have a dual monitor setup on my system, one a monitor, and one a TV. the problem is, my TV is not always on, or someone is using it, therefore I am left with only one Monitor on a dual monitor setup. I could activate and deactive my setup, but that is bothersome. What I wanted to do is create a program that will allow me to move existing windows to specific locations. For example, if a window is stuck on my TV monitor, I can input the coordinates of my computer monitor, and the window will be moved. I have been trying to target the processes, but I don't seem to be able to set the location of the window. Does anyone have any ideas?
|
|
|
|
|
i dont know how to do it in c# but you can do it using hardware profile settings
It is Good to be Important but!
it is more Important to be Good
[My Question]
|
|
|
|
|
Hi Amar Chaudhary.
You can do it, using InteropServices.
Example:
First you need attach the follow namespace
using System.Runtime.InteropServices;
Second you need import the Microsoft Windows Runtime dll's for declare the extern methods.
[DllImportAttribute("user32.dll")]<br />
public static extern bool ReleaseCapture();<br />
<br />
[DllImportAttribute("user32.dll")]<br />
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
Third you need declare the follow constants and methods for invoke the functions
private const int WM_NCLBUTTONDOWN = 0xA1;<br />
private const int HTCAPTION = 0x2;<br />
<br />
private void MoveForm()<br />
{<br />
ReleaseCapture();<br />
SendMessage(this.Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);<br />
}<br />
<br />
protected override void WndProc(ref Message m)<br />
{<br />
base.WndProc(ref m);<br />
<br />
int WM_NCHITTEST = 0x84;<br />
if (m.Msg == WM_NCHITTEST)<br />
{<br />
int HTCLIENT = 1;<br />
int HTCAPTION = 2;<br />
if (m.Result.ToInt32() == HTCLIENT)<br />
{<br />
m.Result = (IntPtr)HTCAPTION;<br />
}<br />
}<br />
}
Finally you need call the function with any MouseDown event
private void button1_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button == MouseButtons.Left)<br />
{<br />
this.MoveForm();<br />
}<br />
}
Remember that you can replace the "this.Handle" for you Window Handle that you want move.
I hope that this resolve your problem.
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
That's great. Thanks for the info.
|
|
|
|
|
you got my 5
It is Good to be Important but!
it is more Important to be Good
[My Question]
|
|
|
|
|
hey shopi30,
I tried using the code, but could not get it working. I can move "my" form by using this.Handle, but if I target another handle, like iexplore, I get nothing. I have tried getting the process handle by process.Handle, and also process.MainHandle, but no luck. Do I have to set focus to the process that I want to move? If so, how do I do that? Also, is there any way that I can specify the x and y co-ordinates of the window, or is it all based on the cursor?
|
|
|
|
|
Hi Now_Loading.
Try using:
[DllImportAttribute("user32.dll")]<br />
private extern static IntPtr GetForegroundWindow();
And change "this.Handle" to "GetForegroundWindow()"
GetForegroundWindow method return the Handle from the current window active.
If this don't solve your problem tell me and I'll be sending you other options.
By the way if you can help me with these System.Data.OleDb & Microsoft Excel I'll be thankful with you.
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
I have one form.
On the form I have many different controls: panels, buttons, datagridviews and others...
How can I do to do when I Click on controls, I have a Message with Control Name?
|
|
|
|
|
In your click-Handler there's a parameter called sender . You can cast it and the get the name of the control.
Like that:
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(((Button)sender).Name);
}
Make sure to do a proper cast if you use a general click handler for all controls.
E.g.
if(sender is Button) { (Button)... }
if(sender is Label) { (Label)... }
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
No, I don't want make click handler for all Controls,
I want use for this for example IMessageFilter
public DataForm()
{
InitializeComponent();
MyMessageFilter MessageFilter = new MyMessageFilter();
Application.AddMessageFilter(MessageFilter);
}
class MyMessageFilter : IMessageFilter
{
const int WM_LBUTTONCLICK = 0x0201;
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == WM_LBUTTONCLICK)
{
???
???
???
}
return false;
}
}
|
|
|
|
|
I haven't used a MessageFilter yet, but the Message struct contains a property named hwnd . You can use Control.FromHandle(m.hwnd) to get the control associated with this message.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I have not understood, you could not give an example?
|
|
|
|
|
Not tested, but something like this:
Control c = Control.FromHandle(m.HWnd);
if(c != null)
{
string name;
if(c is Button) { name = ((Button)c).Name; }
else if(c is Label) { name = ((Label)c).Name; }
...
}
modified 12-Sep-18 21:01pm.
|
|
|
|
|
In what event I do use this:
Control c = Control.FromHandle(m.HWnd);
if(c != null)
{
...
}
|
|
|
|
|
You really need to improve your programming skills, the questions you ask are very basic.
You need to put it there where you placed the question marks:
f (m.Msg == WM_LBUTTONCLICK)
{
???
???
???
}
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I want to display XML file in tree view and then by using popup menu by right clicking on nodes i want to add or delete entries in tree view to make changes in the xml file.
Please guide me about "popup menu", "Adding Nodes" and "Adding ImageList with different node entries".
Also please refer to any existing project if any.
|
|
|
|
|
Hi h@s@n.
You can create a ContextMenuStrip and call the method "show" when the MouseClick event has been fired on any node.
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
Hi
Every control has a ContextMenu property (in framework 1.1) that you can pass a context menu to it and every time you right click on your control the context menu will be shown( you don't have to implement any mouse event)
The tree view control has a image list property that you can pass an image list to it and then you can select the image of a node by setting its ImageIndex property (aNode.ImageIndex=1 for example)
The tree view control has a Nodes collection property that contains all the modes that have been added to a treeview and you can add or remove nodes to it and each node has a nodes collection too that has the same funcionality.
Take a look at http://msdn2.microsoft.com/en-us/library/ch6etkw4.aspx[^]
Regards
|
|
|
|
|
I want to remove the title bar so I can customise the look of a form (e.g. windows live messenger).
But when I set formborderstyle to "None" the form behaves differently;
- The taskbar button looses its menu when you right click it,
- You can't minimize the window by clicking on its taskbar button
- It goes to full screen when you maximize it.
Can anyone suggest a way to sort these problems or provide an alternate way to remove the form boarder that doesn't cause these problems?
Thanks
ps. setting the region of the form solves this problem but I cant find a way to find the correct region as the dimensions of the title bar can vary.
|
|
|
|
|
Hi Sanstrom.
Try changing the property "ControlBox" follow of "FormBorderStyle"
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
I've developed my app using C# and SLQ Server 2005 Express. Now near it's completion, I've just realised I need to create a set-up program that not only deploys my app, but ensure SQLServer Express is also installed, set-up, configured with my database and a default user ready for my App to run straight away.
Where do I start as the end users of my product will not necessarily be IT literate?
Andy
|
|
|
|