|
I don't think there is a direct way to solve this problem. But you could add a boolean column to your DataSet tables and when the check state changes in the tree you could change the values in this column. This way other components using the DataSet would just need to react on the RowChanged event.
|
|
|
|
|
but the problem is that the treeview get it's nodes from the dataset.
on startup I can have several nodes selected and other not.
how can I catch this.
|
|
|
|
|
hi to all,
i'm trying to select all the text in a textbox control (winform) on the enter event.
textBox1.SelectionStart = 0;
textBox1.SelectionLength = textBox1.TextLength;
when the enter event of the textbox si fired with the tab, the text is selected correctly.
but when the enter event of the textbox si fired with the mouse click, no text will be selected in textbox
does any body knows why ? if yes can you tell me what the solution is ?
best regards and thanks in advance
fady sayegh
|
|
|
|
|
That's by design I think. I'll let you know if I think of a work-a-round.
Ed
|
|
|
|
|
The MouseClick event happens after the Enter event. This is so that the user can click where they want the cursor to be positioned. Try placing your code in the MouseClick event.
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
You can postpone the text selection until after the mouse event processing occurs, which ensures that clicking into the TextBox will have the same effect as tabbing into it.
private void textBox1_Enter(object sender, System.EventArgs e)
{
this.textBox1.BeginInvoke( new MethodInvoker( this.textBox1.SelectAll ) );
}
Josh
|
|
|
|
|
|
lots of frustration and angst!!!
I have the answer for you...just solved it in my game I'm writing. Unfortunately my machine died last night (and is now on the curb for trash pickup) and the answer is sitting on my couch in the drive cage!!!
I had to tinker with things a bit but I did get it to work.
Ahhh I remember now....
private void myTextbox_Enter( object sender, MouseEventArgs args )
{
myTextBox.SelectAll();
}
That should do it for you. Darn inconsistant behaviour!!
|
|
|
|
|
Hi
I'm working with Crystal reports and c# windows application. my report is bind using stored procedure to database that accepts 3 parameters. Now I want to add one more stored procedure with same 3 parameters to this report. but crystal report gives following error :
Description: One of the parameter is not supplied
SQL State: 42000
Native Error: 201 [Database Vendor Code: 201]
Can anybody know how to solve this issue?
Warm Regards
Abhijeet B.
|
|
|
|
|
Hi,
I'm starting a process with ProcessStartInfo, setting the 'Arguments' property to a filepath to the file I want to start the process with. However, the process I start is complaining about the filepath - since the filepath has spaces in it, it only seems to pass to the process the filepath upto the first space, and then ignores the rest. The process I'm trying to start is regsvr32.exe and the argument is a filepath to a dll I want to register. Could anyone please help me?
Thanks a lot,
Shehzad
|
|
|
|
|
Use quotes:
regsvr32 "C:\My folder\myLib.dll"
In parameters "\"C:\\My folder\\myLib.dll\"";
Best regards, Alexey.
-- modified at 7:18 Tuesday 18th April, 2006
|
|
|
|
|
Maybe it works if the Arguments string includes quotation marks:
startInfo.Arguments = "\"c:\My File.txt\"";
www.troschuetz.de
|
|
|
|
|
You skipped extra slash:
startInfo.Arguments = "\"c:\\My File.txt\"";
Best regards, Alexey.
|
|
|
|
|
Ups
Thanks for the addition. Hopefully my silly fault didn't cost the questioner some valuable time.
www.troschuetz.de
|
|
|
|
|
Thanks a lot for your help guys, your advice seems to have done the trick!!
Thank you!
|
|
|
|
|
Hey everybody!
I wrote the simplest member I could for a string:
<br />
public string title<br />
{<br />
get<br />
{<br />
return title;<br />
}<br />
set<br />
{<br />
title = value;<br />
}<br />
}<br />
the problem is that when I am trying to set this string with a value, I'm getting a StackOverFlow!
I debugged it, and the value contains the string, but for some reason it keeps on calling itself over and over till the stack is full.
any idea why it happens?!
Thanks in advance!
|
|
|
|
|
your setter is calling the setter...that is until it reaches the maximum stack size - hence the stack overflow.
Your private variable needs to have a different name (or casing) to the setter itself.
-- modified at 6:18 Tuesday 18th April, 2006
|
|
|
|
|
wow, what a silly mistake!
Thanks!
|
|
|
|
|
Howzit people,
I sit with a very interesting problem and I have the feeling that there is an easier way to do what I want to do. In short, I want to loop through the folders on my machine and build a treeview. Here is the code that I use to do it but it is really slow (Windows form with 2 treeviews named tvwSource and tvwDestination):
<br />
private void MainForm_Load(object sender, EventArgs e) {<br />
string path = System.Reflection.Assembly.GetCallingAssembly().Location;<br />
if (tvwSource.Nodes.Count == 0) {<br />
FillTree(ref tvwSource, path);<br />
}<br />
try {<br />
if (tvwDestination.Nodes.Count == 0) {<br />
foreach (TreeNode treeNode in tvwSource.Nodes) {<br />
tvwDestination.Nodes.Add((TreeNode)treeNode.Clone());<br />
}<br />
}<br />
} catch (Exception) {<br />
}<br />
}<br />
<br />
private void FillTree(ref TreeView bindingTree, string path) {<br />
TreeNode rootNode = bindingTree.Nodes.Add("", "My Computer", "mycomputer");<br />
foreach (DriveInfo driveInfo in DriveInfo.GetDrives()) {<br />
if (driveInfo.DriveType == DriveType.Fixed) {<br />
LoopFolders(driveInfo.RootDirectory, ref rootNode);<br />
}<br />
}<br />
try {<br />
bindingTree.SelectedNode = bindingTree.Nodes.Find(path, true)[0];<br />
} catch (IndexOutOfRangeException) {<br />
if (bindingTree.Nodes.Count > 0) {<br />
bindingTree.SelectedNode = bindingTree.Nodes[0];<br />
}<br />
}<br />
}<br />
<br />
private void LoopFolders(DirectoryInfo directoryInfo, ref TreeNode parentNode) {<br />
try {<br />
TreeNode subNode = parentNode.Nodes.Add(directoryInfo.Name);<br />
DirectoryInfo[] subDirectoryInfoArray = directoryInfo.GetDirectories();<br />
foreach (DirectoryInfo subDirectoryInfo in subDirectoryInfoArray) {<br />
if (0 == (subDirectoryInfo.Attributes & (FileAttributes.System | FileAttributes.Hidden | FileAttributes.Temporary))) {<br />
if (0 < (subDirectoryInfo.Attributes & FileAttributes.Directory)) {<br />
LoopFolders(subDirectoryInfo, ref subNode);<br />
}<br />
}<br />
}<br />
subDirectoryInfoArray = null;<br />
} catch (UnauthorizedAccessException) {<br />
} catch (IOException) {<br />
} finally {<br />
}<br />
}<br />
Does anyone know of a quicker way to loop through all the directories on the filesystem?
I used to be vain.... BUT now I'm perfect!
-- modified at 6:11 Tuesday 18th April, 2006
|
|
|
|
|
|
Hello,
I want to use WebBrowser control in my win application. I am using .Net 2.0 c# At that application I need to restrict user navigation in webbrowser control. For example I want to restrict some links in the site. Could you help me?
Thanks,
e119051
|
|
|
|
|
Use "Navigating" event:
<br />
private void OnNavigating(object sender, WebBrowserNavigatingEventArgs e)<br />
{<br />
if (e.Url.Host.Contains("skipped url"))<br />
{<br />
e.Cancel = true;<br />
}<br />
}<br />
Best regards, Alexey.
|
|
|
|
|
I tested it but it didnt work. And I prepared an extended web browser control and implemented startnavigate event.
Thanks alexey.
Now I will try to control pdf or doc activeX, restricting contex menu and rectricting short keys. I think I will need your help.
|
|
|
|
|
I have a problem with thread priorities, the scenario is shown as the following.
A thread of "Normal" priority(Thread-A) is running, and do AutoResetEvent.WaitOne() after it has started another thread of "Highest" priority (Thread-B). Thread-B will do AutoResetEvent.Set() in the middle of it process.
As I have imagined, Thread-A will not move on until Thread-B has finished completely.
But to my surprise, the Thread-A may soon move on if Thread-B does Set().
Why the thread with the highest priority won't finish before threads of low priority move on.
Thank you.
|
|
|
|
|
Thread priority gives you absolutely no control in which order threads are executed. It's just an indicator that if the processor is fully used that one thread gets more of it than another thread. It might even occur that a low priority thread can finish before a high priority thread just because it makes less calculations. So in your example it's correct behaviour that both threads run parallel - only that Thread-B gets a bit more cpu power. I would even go so far that on dual core processors (assuming no other threads/processes are running beside these two) that the priority would not have any effect at all.
If you want Thread-A to run after Thread-B has finished then Thread-B should call Set() at its very end and not somewhere in the middle.
|
|
|
|