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
N

Nobia

@Nobia
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Embedding Collection Controls (Or Any Object) in the TAG Property of Treeview. [modified]
    N Nobia

    I have accidentally discovered something in Visual Studio that (right now) is blowing my mind. I don't know if this is new or old news but it will change how I use Nodes in TreeView and Listview. I would like to hear back on what the community thinks about it. The code included is just test code to illustrate the principle. it is simple so you can experiment with it yourself. It doesn't actually do anything and you need to set breakpoints and check values to see results.

    Background

    Okay. I was playing around with writing my own Newsreader program. Many of the versions out there use TREEVIEW and COLLECTIONS of some type to save the data in. One for a GROUP which holds data for each newsgroup. Then a object collect which holds all the groups. They do similar structures for Articles and groups of articles. I had some trouble getting mine to work. I was using the TAG property of the tree node to hold formatted string data when I accidentally set a TAG to the entire newsgroup collection. I DID NOT GET AN ERROR. Whoa. In short I discovered that the TAG property of a TREEVIEW control can hold an object --- ANY OBJECT ---! Since what I wanted to do was have one node per newsgroup and show headers as subtree nodes - I stored the Newsgroup Collection in the node's TAG property. And it works. I do not need to find the collection and figure out which node to put it in or to find its elements. It in the Node! As a matter of fact the collection stored as a TREEVIEW (thats right - a treeview control that is not placed on a form but is placed inside the TAG property as an object). If I want to fill the sub tree I just iterate the sub nodes from the TAG property into Child Nodes. SIMPLE! And if I change a node inside the TAG Property it updates The Nodes automatically. I do not have to go find it! I really have not had time to explore all the possibilities yet and I am so excited about what i found that I write this (Sloppily) to share what I have found. I will make a better article after so more research. If this is already common knowledge then I'll be heart broken, but I could not find other references to this yet.

    Using the Code

    To play with the code use copy and paste in Visual Studio. * 1. Just create a new project and create an _'Explorer Form"_ from the add items Wizard. * 2. Replace all the code in the "LoadTree()" method of the form * 3. Place Breakpoints where ever you want (End SUB is good start). * 4. Set the Explorer form to be startup form.

    Clever Code csharp visual-studio data-structures help announcement

  • Unhandled Exception: System.InvalidOperationException
    N Nobia

    By Manually deleting the table you did remove it, but there may still be a pointer to the table. In other words the application still thinks the table exists, but cant find it? Try 'Manually' recreating the table (only with minimum data, no need to create entire thing). Then using the proper commands empty the table, THEN delete it. that may fix the problem. otherwise you may need to use a maintenance routine to rebuild your database. ;)

    C# help csharp database visual-studio
  • Login

  • Don't have an account? Register

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