|
Thanks Office Lineman
Its solved part of my problem too.
now the code would be like that:
DataGridView1.ClearSelection();<br />
DataGridView1.Rows[index].Selected=true;<br />
DataGridView1.FirsDisplayedScrollingRowIndex=index;
Thanks and Best Regards.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
|
Our team is developing a product which can capture documents and other data from SharePoint sites.
So far we know we can do this with SharePoint SDK, but our program has to be installed on the SharePoint server, or at least in the Server Farm.
Thus it's very inconvenient to deploy the product.
We would like to know if there's a way to capture the data remotely. That is, can we capture all the SharePoint servers from a central server?
BTW, is it possible that we can know which machine has SharePoint server installed by scanning the AD?
Thanks a lot.
|
|
|
|
|
hi
i could add exe file to my vstudio solution and set build action to Embedded Resource and by working with resources i could take it to stream .
i want to run my exe .. how to that ??
My code is ::
string fullName = this.GetResourceFullName("HDCopy.exe");//i want to run this exe
Stream stream = this.asm.GetManifestResourceStream(fullName);//load my exe to memory
//How to Run My exe from Memory (Stream) ??
private string GetResourceFullName(string resName)
{
string fullName = null;
foreach (string str in this.asm.GetManifestResourceNames())
{
if (str.EndsWith(resName))
{
fullName = str;
break;
}
}
return fullName;
}
|
|
|
|
|
Is HDCopy.exe a .NET exe?
|
|
|
|
|
i want to simulate the mouse ...
so how can i make right click or left click?
what is the command i should use?
|
|
|
|
|
I have used this InterOp snippet:
private const uint MOUSEEVENTF_LEFTDOWN = 0x0002;
private const uint MOUSEEVENTF_LEFTUP = 0x0004;
[DllImport("user32.dll")]
private static extern void mouse_event(
uint dwFlags, // motion and click options
uint dx, // horizontal position or change
uint dy, // vertical position or change
uint dwData, // wheel movement
IntPtr dwExtraInfo // application-defined information
);
private static void SendClick(Point location)
{
Cursor.Position = location;
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, IntPtr.Zero);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, IntPtr.Zero);
}
|
|
|
|
|
thx alot for ur replay...
but i need the event of right click too i tried to make the same code but with intiail value
private const uint MOUSEEVENTF_RIGHTDOWN = 0x0008;
private const uint MOUSEEVENTF_RIGHTUP = 0x000a;
but it didnot work ....
|
|
|
|
|
u can try
MouseEventArgs ev = new MouseEventArgs(MouseButtons.Left,1,0,0,1);
object_MouseDown(sender,ev);
rahul
|
|
|
|
|
the object_MouseDown(sender,ev);
need a using or somthing ...are it function or built in?
so can u tell me plz how to define it,
thx in advance
|
|
|
|
|
the object is like u can take example
if u have added click event for lable1
to simulate this event with out acctualy clicking mouse button
u can make ur custom mouse click event
MouseEventArgs ev = new MouseEventArgs(MouseButtons.Left or MouseButtons.Right,1,0,0,1);
and then call mouse click method of lable like this
Lable1_MouseClick(Lable1,ev);
rahul
|
|
|
|
|
Hi!
for a left click I used SendMessage
Example:
public enum Button_Messages
{
BM_CLICK = 245,
BM_GETCHECK = 240,
BM_GETIMAGE = 246,
BM_GETSTATE = 242,
BM_SETCHECK = 241,
BM_SETIMAGE = 247,
BM_SETSTATE = 243,
BM_SETSTYLE = 244,
}
if you create the application, you have the proccess and the handle,
otherwise you can find it with FindWindow then you can find wihch control to Left click.
Button is the Class name, Import Option is the Text of the control.
hControl = FindWindowEx(windowHandle, IntPtr.Zero, "Button", "Import Options");
Once you have the Control´s handle you can simulate the left click, if SendMessage returns True it was successful, if False it was not possible to perform the click.
SendMessage(hControl, (int)Button_Messages.BM_CLICK, (uint)0, (int)0);
|
|
|
|
|
|
I'm working on a research project that closely resembles a UML class diagram creation program. I started out using Java and JHotDraw to create my own figures, tools, etc, but I really would prefer to use C# as I am much more confident in the language and there are a lot of different aspects to this project which would make C# my preferred language.
Are there any drawing frameworks for C# which allow the programmer to create their own models and creation tools?
|
|
|
|
|
When you have Visual Studio 2003 Enterprise Architect, then you can do it using Visio for Enterprise Architect. You can convert Code->UML or UML->Code.
|
|
|
|
|
I am building a C# window app and am trying to 1. Create a DataAccess class which retrievs the connection string from app.config and then 2. call the DataAccess from a form load.
I have successfully created the DataAccess.cs class but am having difficulties creating the retrieval of the app.config connection string.
Does anyone have suggestions or a GOOD site with a simple C# example of how to do this.
|
|
|
|
|
At the top of your file put:
using System.Configuration;
When you want to retrieve the setting use:
string connString = ConfigurationSettings.AppSettings["MyConnectionStringSetting"];
(Change "MyConnectionStringSetting" to the name of the setting in the app.config[^] file)
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I have a question.
Why do the GNU/Linux users recommend C# if it's not Open Source (it's a Microsoft Technology-Programming Language)?
What happend with Python and Java?
|
|
|
|
|
There is Mono[^] which is C# that run on Lunux.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Yes, but C# is not Open Source. You code in C#.
|
|
|
|
|
C# is an ECMA standard, which is open and that allows things like the Mono project to exist.
See: Standard ECMA-334 C# Language Specification[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Does anybody konw how I can databind some XML to a treeview?
/\ |_ E X E GG
|
|
|
|
|
Aha the urgent guy! So now you are back with a different title line.
First of all, do you want only the DATA part of the XML in your tree view? If you go the normal examples shown in MSDN etc, you will get BOTH TAGNAMES AND DATA in your treeview. As you ar repeatedly asking the question, I am assuming that you need ONLY THE DATA (b'coz otherwise you would have altready got your answer from MSDN etc).
Here is the basic idea of how you can do it. The whole code will be too complex to fit in here. First aof all see the MSDN example from (probably your post only): http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=450892&SiteID=1[^].
From that MSDN example, I will modify ONLY THE button1_Click() method. Not the AddNode() method. You have to follow a slightly different approach here:
private void button1_Click(object sender, EventArgs e)
{
try
{
XmlDocument dom = new XmlDocument();
dom.Load(Application.StartupPath + "\\Sample.xml");
treeView1.Nodes.Clear();
if( dom.DocumentElement.Text == null || dom.DocumentElement.Text == "" )
treeView1.Nodes.Add(new TreeNode(dom.DocumentElement.Name));
else
treeView1.Nodes.Add(new TreeNode(dom.DocumentElement.Text));
if (dom.DocumentElement.HasChildNodes)
{
XmlNodeList nodeList = dom.DocumentElement.ChildNodes;
for(i = 0; i<=nodeList.Count - 1; i++)
{
if( ! ( ( nodeList[i].ChildNodes.Count == 1 )
&& ( nodeList[i].InnerXml == nodeList[i].InnerText ) ) )
AddNode(nodeList[i], treeView1.Nodes[0]);
}
}
treeView1.ExpandAll();
}
catch (XmlException xmlEx) { MessageBox.Show(xmlEx.Message); }
catch (Exception ex) { MessageBox.Show(ex.Message); }
}
Note: Instead of calling AddNode once (as shown in MSDN example) I am calling it for all the childnodes in a loop. That eliminates 1 layer - your trr view won't have the level 2 tags. But now in the AddNode() method, what do you do? Answer is you have to follow a similar logic.
Note the catch logic:
if( ! ( ( nodeList[i].ChildNodes.Count == 1 )
&& ( nodeList[i].InnerXml == nodeList[i].InnerText ) ) )
That is the important part. What does that do? It filters out the TEXT NODE. That IF condition (if you remove the '!' part) will evaluate TRUE only for a TEXT node.
You will have to use that IF logic in your modified AddNode(). It won't be simple, but it is ceratinly possible with some time and effort, which I cannot spend now. You may have to make the subsequent recursive calls to AddNode in 2 different modes - TEXT node mode and TAG NODE mode. To enable that, you may need to add a parameter to AddNode() method (for teh mode). That should use the fact that there can only be 1 TEXT child node in a XML node. So when you get that, break out. Add the tree node and then call in TAG mode with the newly created tree node as parameter, but the current XML node (not the TEXT node but its parent) as parameter.
I have done such juggleries before, and I am confident that this is just a brain twister.
Koushik Biswas
who else?
|
|
|
|
|
My app has to render a bitmap by scanning a FP measurement array, using a lookup table type process. In the old C++/MFC app that does more or less the same thing, the rendering runs very noticably faster using the same camera and image size, on the same PC.
In C#, I was using the SetPixel command, but this is still as slow as the infamous GDI SetPixel call. Getting a pointer to the bitmap data in an 'unsafe' code block speeds up the process by a factor of about 2.5, but its still slow.
So my questions are these.
1) Will calling an unmanaged C++ DLL function (derived from my old app) execute faster than the C# code? I'm thinking about DLL load overhead and similar.
2) Is it possible to embed C++ code directly in the C# project? My books and VS help seem to hint at this, but I have yet to find an explicit answer.
Thanks for any ideas.
Stewart DIBBS
|
|
|
|
|
sjdevo3gsr wrote: 1) Will calling an unmanaged C++ DLL function (derived from my old app) execute faster than the C# code? I'm thinking about DLL load overhead and similar.
Yes, in this case. Native pointer math is always faster for bitmaps, all other things being equal. If you're doing a lot of memory access and you're sure your not going to overrun any buffers or anything, unmanaged code can be blazingly faster for bitmap work. You may also have easier access to BitBlt and similar functions, which could save you a lot of math.
sjdevo3gsr wrote: 2) Is it possible to embed C++ code directly in the C# project? My books and VS help seem to hint at this, but I have yet to find an explicit answer.
You can put managed C++ classes in your C# project/solution. They're still managed, though. That may not necessarily be bad.
You can also but "unsafe" C# code inline in your C# files. That will allow you to use pointers. It's not going to be as fast as native Win32 C code, but it'll allow pointer math, which could save you time over ordinary C# code in this case.
|
|
|
|
|