Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AndrewVos

@AndrewVos
About
Posts
96
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Thoughts on Flash
    A AndrewVos

    That is very sad.

    www.andrewvos.com

    The Lounge com adobe question discussion

  • measure string
    A AndrewVos

    TextRenderer should work for this. http://msdn.microsoft.com/en-us/library/system.windows.forms.textrenderer.measuretext.aspx[^]

    www.andrewvos.com

    C# question graphics

  • how to secure webservices without providing username and password?????????
    A AndrewVos

    You're looking for OpenId maybe?


    www.andrewvos.com

    Web Development database security help tutorial question

  • How to change the classname???
    A AndrewVos

    If you want to use SendMessage to send something to a window, do what was mentioned above. Maybe inherit a NativeWindow, and set the caption to something like "My Special Window". Then you can use FindWindow("My Special Window") to find the handle of the window you want to SendMessage to. All you need to do then is override WndProc in the NativeWindow. Have a look at FindWindow on pinvoke.net.


    www.andrewvos.com

    C# csharp help tutorial question

  • Alright....
    A AndrewVos

    That's bash.org ;)


    www.andrewvos.com

    The Lounge csharp question

  • How to change the classname???
    A AndrewVos

    Hmm. Doesn't work.


    www.andrewvos.com

    C# csharp help tutorial question

  • How to change the classname???
    A AndrewVos

    Override CreateParams, and set the class name yourself. Not sure if it will give you an exact name though, but it's worth a try.


    www.andrewvos.com

    C# csharp help tutorial question

  • Events
    A AndrewVos

    You can check the FormClosingEventArgs in FormClosing. Allows you to cancel closing the form. I don't really know if the child forms will stay open, but it sounds logical that they will.


    www.andrewvos.com

    C# question

  • Explicit Safety in SA
    A AndrewVos

    Oh, it's definately afrikaans. It's from SA, and it was taken in simons town I think. Was drunk at the time!


    www.wickedorange.com www.andrewvos.com

    The Lounge com

  • Explicit Safety in SA
    A AndrewVos

    That's my photo :)


    www.wickedorange.com www.andrewvos.com

    The Lounge com

  • Weird "Inconsistent Accessibility" problem
    A AndrewVos

    That compiles for me. Is that the exact code?


    www.wickedorange.com www.andrewvos.com

    C# help css question

  • Get the proper path name, proper case I mean.
    A AndrewVos

    Ok, I've got everything working. It seems GetDirectories is actually fast enough when using a search pattern. Thanks for reading through the code, and here's what I'm using now. public List Generate(string generationString) { List results = new List(); string[] pathParts = generationString.Split(Path.DirectorySeparatorChar); DirectoryInfo currentDirectory = null; for (int index = 0; index < pathParts.Length;index++ ) { string pathPart = pathParts[index]; if (index == 0) { //The first part will be the drive. DriveInfo[] drives = DriveInfo.GetDrives(); foreach (DriveInfo drive in drives) { if (drive.Name.StartsWith(pathPart, StringComparison.InvariantCultureIgnoreCase)) { currentDirectory = drive.RootDirectory; } } if (currentDirectory == null) { break; } } else if ((index == pathParts.Length - 1) ) { //The last part could be anything, so we do a wildcard search. try { results.AddRange(Directory.GetDirectories(currentDirectory.FullName, pathPart + "*")); results.AddRange(Directory.GetFiles(currentDirectory.FullName, pathPart + "*")); } catch { } } else { //Just add the first result to the path. DirectoryInfo[] searchResults = currentDirectory.GetDirectories(pathPart); if (searchResults.Length == 0) { break; } else { currentDirectory = searchResults[0]; } } } return results; }


    www.wickedorange.com www.andrewvos.com

    .NET (Core and Framework) database com performance help tutorial

  • Get the proper path name, proper case I mean.
    A AndrewVos

    string fixedPath = @"c:\program files\"; FileInfo fileObject = new FileInfo(fixedPath); fixedPath = fileObject.FullName; MessageBox.Show(fixedPath); This would return "c:\program files".


    www.wickedorange.com www.andrewvos.com

    .NET (Core and Framework) database com performance help tutorial

  • Get the proper path name, proper case I mean.
    A AndrewVos

    Well, so it looks right to the user. I'm working on a bit of autocomplete code (like the Run dialog). I do know about ComboBox/TextBox autocomplete, but it doesn't meet the specs.


    www.wickedorange.com www.andrewvos.com

    .NET (Core and Framework) database com performance help tutorial

  • Get the proper path name, proper case I mean.
    A AndrewVos

    I'm looking for a way to get the proper path name, for example if I have: "c:\\program files" I would expect "C:\\Program Files". Any ideas? I'm using the code below now, but the use of GetFileSystemInfos is going to be a performance problem some time... private string fixPathName(string path) { string[] pathParts = path.Split(Path.DirectorySeparatorChar); string fixedPath = null; for (int index = 0; index < pathParts.Length; index++) { string pathPart = pathParts[index]; if (index == 0) { fixedPath = pathPart; fixedPath = Path.GetFullPath(fixedPath); } else { fixedPath = Path.Combine(fixedPath, pathPart); DirectoryInfo parent = Directory.GetParent(fixedPath); FileSystemInfo[] paths = parent.GetFileSystemInfos(Path.GetFileName(fixedPath)); string pathProperName = paths[0].FullName; fixedPath = pathProperName; } } return fixedPath; }


    www.wickedorange.com www.andrewvos.com

    .NET (Core and Framework) database com performance help tutorial

  • [Message Deleted]
    A AndrewVos

    [Message Deleted]

    C#

  • Bug in ListView.Items.Insert(int,ListViewItem)?
    A AndrewVos

    Thanks for checking it out. What version of .NET?


    www.wickedorange.com www.andrewvos.com

    .NET (Core and Framework) help com question

  • Comparing enums?
    A AndrewVos

    *The enum Equals can take two enum values


    www.wickedorange.com www.andrewvos.com

    C# tutorial question

  • Comparing enums?
    A AndrewVos

    You're trying to compare the types to each other. The enum Equals takes two enum values.


    www.wickedorange.com www.andrewvos.com

    C# tutorial question

  • Bug in ListView.Items.Insert(int,ListViewItem)?
    A AndrewVos

    I seem to have found a bug in ListView.Items.Insert(int,ListViewItem). Could someone please try reproduce this? Maybe I could get a bug report submitted. (Problem seems to occur on 2.0 and 3.5) Steps to Reproduce: 1. Start a new project 2. Add a ListView with five items in it. 3. Label them 1 to 5 so we can see what happens. 4. Add a Button. 5. Add the following code to Button.Click: ListViewItem item4 = this.listView1.Items[3]; item4.Remove(); this.listView1.Items.Insert(0, item4); The items should be arranged like this: 4 - 1 - 2 - 3 - 5 Instead we see this: 1 - 2 - 3 - 5 - 4 Workaround: I have found if we switch to View.Details before doing the remove/insert then everything works fine. Replace the code in Button.Click with this: ListViewItem item4 = this.listView1.Items[3]; View oldView = this.listView1.View; this.listView1.BeginUpdate(); this.listView1.View = View.Details; item4.Remove(); this.listView1.Items.Insert(0, item4); this.listView1.View = oldView; this.listView1.EndUpdate();


    www.wickedorange.com www.andrewvos.com

    .NET (Core and Framework) help com question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups