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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
T

T Willey

@T Willey
About
Posts
30
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Inheritance on ListViewSubItem, BackColor
    T T Willey

    Thanks you! This has been bugging me for a couple of weeks. I don't know how I missed that property of the ListViewItem, but it seems to be what I'm looking for.

    Tim

    C# oop question

  • Inheritance on ListViewSubItem, BackColor
    T T Willey

    This is my first attempt at inheritance, and it seems to be working okay, but I want to be able to assign a back color to visual show that the sub-item has been selected (new property I gave it). I used the Reflector to see how the code is done on the original ListViewSubItem, but I can do it the same as, as they assign the back color to the SubItemStyle, and I can't get to that since it's protected. Is there any other way to do what I want, or am I out of luck? Thanks in advance.

    Tim

    C# oop question

  • Send print file to printer, C#
    T T Willey

    Thanks for the idea. I will see what I can do.

    Tim

    C# csharp help tutorial

  • Send print file to printer, C#
    T T Willey

    I have searched and searched and have found nothing that will help me. I have a formatted file to send to a printer. I have to do it this way because I can't print straight from the program (AutoCAD) to a printer, so I have to print to a file. I can do this just fine, but I can't see how to copy the .plt files to the printer port. This is just my thinking (copy the file to the printer through the printer port), if I'm wrong please point me in the right direction. Thanks in advance.

    Tim

    C# csharp help tutorial

  • Unkown array length of arrays; How?
    T T Willey

    It appears once again I have gone the wrong way. I get caught up in arrays when I try to use C# in place where I don't have to. Instead of putting the items into an array, and then into the dialog box, I just put them into the dialog box when I get them. I thank the people who responded and helped me, I hope you don't think I wasted your time, as I did learn some new things that I think will be helpful in the future. One thing I did look into was the list class, but since the program I'm programming for only use .Net1.1, that doesn't work for this issue at this time. Once again Thanks.

    Tim

    C# csharp data-structures help tutorial question

  • Unkown array length of arrays; How?
    T T Willey

    Thanks again Stefan. I think I can make this work. I hate the idea of just asking for people to do things for me. I only ask when I can't find how to do something, either with the help files, or a search on the net. I have not used lists in C# yet, in (Auto)Lisp I use them all the time, and love them. I hope they are kind of the same way in C#.

    Tim

    C# csharp data-structures help tutorial question

  • Unkown array length of arrays; How?
    T T Willey

    Thank you Stefan. I'm not sure how to use this yet, but it looks like it might work. Let me experiment with it, and if I can't figure it out, I will post back.

    Tim

    C# csharp data-structures help tutorial question

  • Unkown array length of arrays; How?
    T T Willey

    What I have is a csv file that has the names of my drawings, and the revision level they are at in the repository. I want to take that file and fill in a dialog box with the information for it, and the drawing. I can get the current level from the drawing, I have code for that already. Then if the revision level of the drawing needs to be updated (long story, happens alot) then I can pick it in the dialog box, type what the new revision should be, and have it update the drawing. I'm thinking of having it as a list view, with details shown in the dialog, so all the items will be on one line, and have the options of headers. Where I'm stuck at is, trying to create an way to have a list/array nested in another list/array that will fill out my dialog box. I don't know how long the main lis/array will be, but the sub list/array will only be three items. Hope that explains it a little more clearer. Thanks for helping.

    Tim

    C# csharp data-structures help tutorial question

  • Unkown array length of arrays; How?
    T T Willey

    Yea, I think I have a problem. The way I want to do it doesn't seem to want to work. I see that there is a method of the file class that will read all the lines to a string array. If I use that, then I will know the length, but then I'm reading the information twice, which will be slower. I will still look for other ways. Thanks for the hints.

    Tim

    C# csharp data-structures help tutorial question

  • Unkown array length of arrays; How?
    T T Willey

    I guess if you only know one of the two amounts needed, don't put either one. This appears to be working right now, will see if it works for the final project. string[,] StrAr; If this is wrong, please let me know. Thanks.

    Tim

    C# csharp data-structures help tutorial question

  • Unkown array length of arrays; How?
    T T Willey

    So I'm reading infomation from a text file. It will have two values, and I will supply a third. I don't know how to define the variable since I don't know how many lines will be in the text file, but I do know that the arrays within the main array will have three values. So I was thinking along the lines of. string[,3] StrAr; or string[3,] StrAr; Just to get it defined, but that didn't work. I'm new still to C#, since it is not my primary language, and the one I have a background on only seems to work in the program I learned it in (Lisp through AutoCAD). Any help/comments is/are appreciated. Thanks in advance.

    Tim

    C# csharp data-structures help tutorial question

  • How to free up memory
    T T Willey

    Thanks for the heads up Luc. I write C# very infrequent, so these are nice tips to know.

    Tim

    C# help question graphics performance tutorial

  • How to free up memory
    T T Willey

    I was thinking that once it was done searching the drive then it wouldn't need to consume as much memory. If I'm wrong, then I think it will be fine, I was just trying to optomise it. Thanks again Nader. I never did get the other program you were helping me with to work, and the person I was doing it for found another way, so I stopped trying after like 7 revisions.

    Tim

    C# help question graphics performance tutorial

  • How to free up memory
    T T Willey

    I have this program I wrote that will search the entire c drive and make a treeview dialog of all the folders with the memory taken up by the folders. I can understand that this process should take up some memory, but once it finishes it should release the memory because all you are doing now is looking at the treeview which has been all filled out already with all the information that it will ever have. I guess I'm trying to say that once the dialog comes up, how can I free some of the memory that my program has taken up? On my machine it has taken up to 30k of memory, and held it until I close it. Here is the code. Thanks in advance for any help. If this is too much code, let me know and I will edit my post. using System; using System.Drawing; using System.IO; using System.Windows.Forms; namespace MemoryManagmentDialog { /// /// Description of MainForm. /// public class MainForm : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; private System.Windows.Forms.TreeView treeView1; public static double GetDirectorySize (DirectoryInfo Di, TreeNode ParentNode, bool IsFirst) { double DirSize = 0; try { FileInfo[] fiAr = Di.GetFiles (); foreach (FileInfo fi in fiAr) { DirSize = DirSize + fi.Length; } DirectoryInfo[] diAr = Di.GetDirectories(); if (IsFirst == true) { foreach (DirectoryInfo di in diAr) { DirSize = DirSize + GetDirectorySize (di, ParentNode, false); } } else { TreeNode SubNode = new TreeNode (Di.Name); foreach (DirectoryInfo di in diAr) { DirSize = DirSize + GetDirectorySize (di, SubNode, false); } ParentNode.Nodes.Add (SubNode); SubNode.Text = Di.Name + " - [ " + SizeToString (DirSize, SubNode) + " ]"; } } catch { TreeNode SubNode = new TreeNode (Di.Name); ParentNode.Nodes.Add (SubNode); SubNode.Text = Di.Name + " ** [ Error ]"; SubNode.BackColor = Color.Red; SubNode.ForeColor = Color.White; } return DirSize; } public static string SizeToString (Double dbl, TreeNode tn) { string Str; if (0 <= dbl && dbl < 1000) { Str = dbl.ToString() + " b"; tn.BackColor = Color.Orange; return Str; } else if (1000 < dbl && dbl < 1000000) { Str = (dbl / 1000).ToString() + " KB"; tn.BackColor = Color.PaleGreen; return Str; } else if (1000000 < dbl && dbl < 1000000000) { Str = (dbl / 1000000).ToString() + " MB

    C# help question graphics performance tutorial

  • Object array question
    T T Willey

    True. Thanks of the tips Guffa. I'm just starting, so help/tips are always appreciated.

    Tim

    C# help algorithms data-structures testing beta-testing

  • Object array question
    T T Willey

    Thanks Guffa. Here is how I solved it, incase only looks at this. int intTest = string.Compare(TestStr, tempStr, true); if (TestStr.Length < tempStr.Length || (intTest < 0 && tempStr != "" && TestStr.Length == tempStr.Length)) { --NewArLoc; } This is the portion I added to my check. && TestStr.Length == tempStr.Length Tim

    C# help algorithms data-structures testing beta-testing

  • Object array question
    T T Willey

    I thought that is what I was doing here, and I wrong? int intTest = string.Compare(TestStr, tempStr, true); if (TestStr.Length < tempStr.Length || (intTest < 0 && tempStr != "")) { --NewArLoc; } I saying that the NewArLoc is equal the to the length of the array minus one. Then if the length of the string I'm working with 'TestStr' is shorter that the one I'm testing it against 'tempStr', or the value is less (value from string.Compare), then minus one. I want the lowest string value to be first in the array............. I see what you mean now. Let me see what I can come up with. My test line isn't correct. It will test the length, and then if 'TestStr' is longer, then it will test the value of the compare, which it shouldn't. I will have to rewrite that part. Thanks. Tim

    C# help algorithms data-structures testing beta-testing

  • Object array question
    T T Willey

    It doesn't really stop the code, it's just that the finished product isn't correct if the string has more than one character. I'm still on framework 1.1. This code is use to update revision levels. So if the current revision is A, the new one is B. So if the current one is Z, the new one is AA. We show three revision levels on our drawings. Sometimes they are in the correct order, and sometimes they are not, so I'm sorting them first before I update the revisions. So say I have revisions 'AA', 'Z', 'Y' (in order top to bottom). It will say that the new revision is 'Z' and will order them 'Z', 'Y', 'Z', in this order from top to bottom, when it should be 'AB', 'AA', 'Z'. This is why I'm thinking something is wrong in the sorting code I posted.

    Tim

    C# help algorithms data-structures testing beta-testing

  • Object array question
    T T Willey

    I am sorting an array of object arrays (string,int). It will work fine is the string is only one character long, but if it is two it will error. I'm not sure why or how it errors. I have done some testing, but still don't understand how to fix it. Any help is appreciated. Thanks in advance. private object[,] SortByFirst (object[,] RevAr) { object[,] NewAr = new object[3,2]; for (int i = 0; i < (RevAr.Length / 2); ++i) { int NewArLoc = (RevAr.Length / 2); --NewArLoc; string TestStr = RevAr[i,0].ToString(); for (int j = 0; j < (RevAr.Length / 2); ++j) { if (i != j) { string tempStr = RevAr[j,0].ToString(); int intTest = string.Compare(TestStr, tempStr, true); if (TestStr.Length < tempStr.Length || (intTest < 0 && tempStr != "")) { --NewArLoc; } } } NewAr[NewArLoc,0] = RevAr[i,0]; NewAr[NewArLoc,1] = RevAr[i,1]; } //MessageBox.Show (NewAr[0,0].ToString() + NewAr[0,1].ToString() + "\n" + NewAr[1,0].ToString() + NewAr[1,1].ToString() + "\n" + NewAr[2,0].ToString() + NewAr[2,1].ToString()); //MessageBox.Show (NewAr[2,0].ToString()); return NewAr; } The inital array could look like { {"A",0} {"C",6} {"B",12} } This array would work, and would be returned like { {"A",0} {"B",12} {"C",6} } ps. I don't know how to post code correctly still, so sorry for the way my post looks. Tim

    C# help algorithms data-structures testing beta-testing

  • How to increase string character value
    T T Willey

    Thanks for the code Michael.

    Tim

    C# tutorial 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