|
ok, solved it. The idea is to have treeview beginupdate in the begginning of the textchanged delegate invocation and endupdate at the end when all nodes are updated.
public class TagObject
{...
public event EventHandler TextChanged;
public int TextChangedCount;
public bool startOfInvocation;
...
public void OnTextChanged(TextChangedEventArgs e)
{
if (TextChanged != null)
{
this.TextChangedCount = TextChanged.GetInvocationList().GetLength(0);
this.startOfInvocation = true;
TextChanged(this, e);
}
}
*******************************************************************8
public class MyTreeNode : TreeNode
{...
public void UpdateTagText(string text)
{
((TagObject)this.Tag).Name = text;
}...
public void UpdateText(object sender, EventArgs e)
{
TagObject tagObj = (TagObject)this.Tag;
if (tagObj.startOfInvocation)
{
this.TreeView.BeginUpdate();
tagObj.startOfInvocation = false;
}
this.Text = ((TextChangedEventArgs)e).Text;
tagObj.TextChangedCount--;
if (tagObj.TextChangedCount == 0)
{
this.TreeView.EndUpdate();
}
}
takes about a sec for 500 nodes.
|
|
|
|
|
I have a Windows Service written in C#.
This service uses PInvoke to interface with a DLL written entirely in MFC.
When I debug the service, VS 2010 refuses to step into the dll, and doesn't even show it loaded in the Modules window. I know it's loaded because the service is performing its intended function.
I have checked the box that says, "Enable native code debugging," and I can't figure out why VS 2010 isn't letting me debug the DLL.
Is there some trick to it?
|
|
|
|
|
|
I typically don't use Visual at all to debug mixed managed/native situations. I tend to rely on logging most of the time, so I always implement logging on the managed side, then add it on the native side too, and make sure they get merged early on.
If interested, have a look at "two-side logging" in this article[^].
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks Luc. It used to work in 2008, though. I wonder what they broke.
|
|
|
|
|
Can't help you there, haven't done any native code development on VS2010 yet.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi everyone , i need a way to embed excel sheet in my windows form in C#
i need a way to embed it in my application either depending on preinstalled office package or without , i don't care , i just need to show the excel sheet hosted within my windows form application .
is there a way ????
Human knowledge belongs to the world.
|
|
|
|
|
|
First thank you for your honest reply .
i have looked at the web page you have sent to me , but they said that the web components are discontinued for office 2007 .
any way , i have found a good solution , really amazing solution , it is called DSO Framer ActiveX control from microsoft , it is built using c++ , it is a collection of c++ wrappers that can open any type of office files embedded into your windows application , it is awesome my friend you should look at it .
you can go to cnet.com and search for dsoframer , when you download it you will find good samples written in c++ and vb.net that uses that amazing control to host office files , it is really awesome .
do you know any way to embed pdf files as well ???
Thank you my friend for your reply
Human knowledge belongs to the world.
|
|
|
|
|
snouto wrote: do you know any way to embed pdf files as well ???
You could abuse the WebBrowser control to display the PDF. Should work as long as there's a reader installed
I are Troll
|
|
|
|
|
so I have a DateTimePicker that currently is set to show time only.
right now when the user clicks on the drop down button it shows the calendar.
I need a method to only show time or disable the dropdown event from happening so not to show calendar
this control I need it for Time Selection only//
Any Ideas?
Thanks in advance
|
|
|
|
|
There are two properties which have to be set to achieve your aim
1) ShowUpDown = true will disable the drop down calendar
2) Format = DateTimePickerFormat.Time will removes the date component of the display
Alan.
|
|
|
|
|
ShowUpdown Property True
and Custome Format set hh:mm:ss:tt
|
|
|
|
|
We're having an issue with our project. Our software switches back and forth between a GPS software and our program. We have a button that we want to paint over the GPS software. The purpose of this button is to navigate back to our actual program from the GPS software. However, we're having some issues with painting and the two applications fighting for a top most position. When we try to give our button a top most position, it keeps having its LostFocus event called, which makes me believe that the two are indeed fighting for top position. Assuming this is true, what would be the best way to go about restricting the GPS window from having the top most position?
Thanks ahead of time.
-Brandon
|
|
|
|
|
Don't try to have anything on top of something else. Think of a better way to achieve what you want.
|
|
|
|
|
Hi,
when i am binding datatable to datagridview, it is not showing all the records in the datagridview..
it is displaying only 1 Record in datagridview..
actual records in datatable are 12.
have any idea,let me know..
here is my code
public static DataTable dtable = new DataTable();
private void ScheduledJobs_Load(object sender, EventArgs e)
{
try
{
FillGrid();
if (dtable.Rows.Count > 0)
{
dgrid.DataSource = dtable;
}
}
catch { }
}
private void FillGrid()
{
try
{
if (dtable.Rows.Count == 0)
{
ProcessStartInfo ps = new ProcessStartInfo("SCHTASKS", "/QUERY /fo table");
ps.RedirectStandardOutput = true;
ps.UseShellExecute = false;
Process p = Process.Start(ps);
p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
p.BeginOutputReadLine();
}
}
catch { }
}
System.Collections.ArrayList ar = new System.Collections.ArrayList();
int first = 0;
void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
try
{
if (first == 0 && dtable.Columns.Count == 0)
{
dtable.Columns.Add("Task Name");
dtable.Columns.Add("Next RunTime");
dtable.Columns.Add("Status");
}
ar.Add(e.Data);
if (first > 2 && ar[first] != null)
{
DataRow dr = dtable.NewRow();
dr[0] = ar[first].ToString().Substring(0, ar[first].ToString().IndexOf(':') - 2).Trim();
dr[1] = ar[first].ToString().Substring(ar[first].ToString().IndexOf(':') - 2, 20).Trim();
dr[2] = ar[first].ToString().Substring(ar[first].ToString().IndexOf(':') + 18).Trim();
dtable.Rows.Add(dr);
}
first++;
}
catch { }
}
Thanks in advance.
Pawan.
|
|
|
|
|
I am surprised there are any rows in the grid at all. You never call DataBind(). When you step through the code int he debugger with a watch on dtable.Rows.Count and a breakpoint at dgrid.DataSource = dtable;
are you sure it says 12? Or are you just assuming there should be 12 records when it gets to that point?
|
|
|
|
|
hi
before posting this question only i checked all the above things which u said.
it is showing perfect 12 records dtable.rows.count in immediate window
when i am binding the same to Datagridview also, the dgrid.rows.count is 12 only..
but it is not showing the 12 records in grid, instead of 12 it displays only 1 record..
Let me know if u have any solution..
Thanks and Regards,
Pawan.
|
|
|
|
|
how i can use Assembly code in C# ?
|
|
|
|
|
shahramkeyboard wrote: how i can use Assembly code in C# ?
That depends largely on what you mean with "assembly code";
- If it's code that's stored in an assembly, then simply load it.
- Assembly might also refer to IL, which is explained here[^]. That's specific to the .NET VM.
- If you're referring to plain old assembler, then I'd suggest you install Turbo Pascal.
I are Troll
|
|
|
|
|
You can't directly. .NET uses a form of intermediate language which is intended to be target neutral. If you want to use assembly code, you need to look at writing your application either in assembly, or in C/C++. .NET is entirely the wrong choice here.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Yeah, can't be done directly, but I would guess it can be done. Create a C++ project that uses "__asm {...}", reference that project from a managed C++ project, then reference that project from a C# project. Might have to mark some functions as "unsafe" or something, but I would guess something like that would work.
|
|
|
|
|
Wouldn't there be a more direct way? Such as doing the __asm part in C++/CLI and merging it with the compiled C# with ILMerge? (would that work?)
|
|
|
|
|
I thought ILMerge only worked for IL assemblies. C++ with assembly code would compile directly to machine code. Would ILMerge still work then? And even if it did work then, I don't understand how that would make things more direct than creating a few projects and having a couple references in Visual Studio.
|
|
|
|
|
That's why I was planning C++/CLI, it makes mixed assemblies right?
At the very least, mixed assemblies exist in the wild, even though I'm not sure how they were made..
|
|
|
|