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
K

keith maddox

@keith maddox
About
Posts
21
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • number to alpha
    K keith maddox

    Wow, that would not be too hard but would require more time to explain than I think most of us would be willing to put in, but if it's okay, let me get you started and I think you can figure the rest out on your own. seperate your problem into periods. A period is the three number grouping deliniating hundreds, thousands, millions .... ie 42,233,123 so this should convert to the string "fouty two million, two hundred thirty three thousand, one hundred twenty three" right? so now you have three strings : "42" , "233", "123" now take each of those strings and make a post-period-word for them to tack on later, so you'd have: "Million", "Thousand" Dont worry about the last string, that one will just be worded on its own. now convert the number in each of the strings and convert them into words. You can figure this out on your own and its not too hard but think carefully about it, there are some special cases here! This is kind of a recursive algorithm but there are a few special cases you'll need to code for like not wording the last group. For instance you would not want to save "One Hundred Twenty Three Hundred". Have fun.

    C# question tutorial

  • How to suspend drawing operation of a form ?
    K keith maddox

    I'll give this a shot but a .NET guru might be able to point out a fatal flaw in my case, but here goes. I know for sure that we could do something like this with streight WinAPI stuff but how will .NET controls handle it. Who knows. Anyway the theory works like this. The message pump for your application is dispatching messages to all of your windows and controls. Just disable the pump, do your thing with the controls (in a non-gui thread) but be carefull not to use any blocking calls that rely on a message back (the pump is off now remember), then when you are all done, turn the pump back on and issue a WM_PAINT. I've done similar things in C++ using the WinAPI without hitches (usually). Also note that the manipilation of the controls is being done in a NON-GUI thread but I think that as long as you are carefull about what you are doing to those controls, you should be alright. Be quick though because I believe windows sends some kind of a heartbeat message every so often and if it detects that your pump is down, it'll pop up a dialog saying your app has stopped responding. Not sure the mechanism winsdows is using for this but i suspect it's using a WM_NCPAINT to detect this somehow. Not sure how to turn the pump (message dispatcher) off in .NET application but I assume it's probably pretty easy. *** NOTE I assume that the controls you try to move about the form are issuing an Invalidate which causes the main form and the control to receive a WM_PAINT... Make sure you are not issuing and Invalidate or a refresh anywhere in your code that moves these around until you are all done. Probably not too much help but it'll give you a starting point. .NET GUI gurus, any ideas? Will this blow up in his face in .NET?

    C# tutorial graphics question

  • Binary serialization questions
    K keith maddox

    #1 Just put the serializable attribute atop your class #2 Yes they are and will be automatically, if used in your serializable class the class you are deriving from not being serializable should not be a problem unless the class does some stuff that almost deliberlately makes it nonserializable. Give it a try, it should work flawlessly. Use the .NET serialization routines to save and restore your class, you'll find it works quite easily. Use the .NET Binary serializer in your main code to save/restore these class objects.

    C# json question

  • Showing legacy data in data grid
    K keith maddox

    Okay, here is some sample code. Sorry it's not real orderly but I just don't have time to make it real nice. I think you'll get the idea though. this code will populate a datagrid with three columns times x rows (just an exmaple, you could have as many columns as you like) from a mock of what I think your API looks like. Here is the form --------------------------------------------------------------- using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace SampleOfIList { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.DataGrid dataGrid1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { InitializeComponent(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.dataGrid1 = new System.Windows.Forms.DataGrid(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.SuspendLayout(); // // dataGrid1 // this.dataGrid1.DataMember = ""; this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; this.dataGrid1.Location = new System.Drawing.Point(8, 8); this.dataGrid1.Name = "dataGrid1"; this.dataGrid1.Size = new System.Drawing.Size(640, 160); this.dataGrid1.TabIndex = 0; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(656, 197); this.Controls.Add(this.dataGrid1); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); }

    C# csharp css wpf wcf json

  • Showing legacy data in data grid
    K keith maddox

    Let me give you some source code. Check back friday mid day or so.

    C# csharp css wpf wcf json

  • Showing legacy data in data grid
    K keith maddox

    So the grid would look something like this right? RowNum ColNum Data ------- ------- ---------------------- 0 0 some data here 0 1 some more data 1 0 data 3 fe 1 1 yet more data if so, I see no problem with my earlier suggestion, the objects stored in IList impl would be the result from SomeType* TABLE_GetValue(TblPtr tbl,int col,int row) times n rows for the grid so the list would look like: 0,0,somedata 0,1,somemoredata etc... Is that what we are going for? If so then maybe some sample code from me would help! Let me know

    C# csharp css wpf wcf json

  • Showing legacy data in data grid
    K keith maddox

    Ahh right. Well then implement an IList class just as you had planned. If we call your class Bob then use Bob's Item to store each of your structs. Thats the 2D element you were missing! Implement the IList.Add and additionally override Bobs Add mthd with one for the type of the struct. Do this with Remove and whatever else you'll need and you might want to do this with an indexer as well just to make access easy if you're using it for other things outside the grid. hope that helps.

    C# csharp css wpf wcf json

  • Moving huge amounts of Data over Local/Lan
    K keith maddox

    Hi Lazar, when you are sending large amounts of data over a network, your best bet is to use the most compact form available, xml would be a good choice for a smaller load, but if there is truely a lot of data, then you might consider sending it in binary form and yes, you can and probably should use .NET sockets. These are pretty easy to use with a little practice but might give you a little frustration at first. Don't give up on them though because they are the very best way to move large pieces of data across the network. For #2, I would probably spool the data into and out of an xml DataTable so the grid can see them directly. Look at the DataTable object in .NET! Create one and play around with the Grid connected to it, it's pretty easy once you get the hang of it. As far as #3 is concerned, not enough detail for me to say, sorry, but I will say it is most likely not a bug in the grid as I've used it extensively for some time without problems unless I was doing something wrong. Good luck on your project.

    C# sysadmin question xml help tutorial

  • Help required abt Dynamic dll.
    K keith maddox

    Sorry I'm not completely understanding, do you want to compile the dll conditionally, only when you want, or do you mean that the application should only load the DLL when it is needed (which is the decault behavior in .NET anyway) ?

    C# csharp help tutorial

  • Screen Scraping
    K keith maddox

    This is a perticularly troublesome issue since you are dealing with a windows application you want to scrape the data from. You can get the window handle! It is kind of involved but you can get it from it's location, or, you can get it from the module handle but you'll need to use windows API which involves some interop. In the end, you might not even be able to get the information depending on if standard windows controls are used or not. Assuming you have the window handle and that the data you are getting is in a standard list box, you can get at it. You mentioned picures though and I know of no non-convoluted way to scrape that. You can get a binary image right off the screen but the window will need to be made topmost, but what if another window overlaps between the time you bring it to the top and you start scraping? Screen scraping is generally reserved for application where data is in text that is rendered to a destination that supports reading it back as text. In the GUI world you'll need to rely on asking some control for that information and that may or may not be possible, depending on the control which rendered it. If possible, I'd look at getting at the data in some other way, perhaps its storage medium? Probably not much help but...

    C# question

  • How do I stop momentary appearence of titlebar in MDI child?
    K keith maddox

    I do this kind of UI trick here at work all the time so try what I do, just turn off the border altogether, that works great!

    .NET (Core and Framework) question csharp visual-studio

  • Problems running NUnit tests
    K keith maddox

    I've not noticed them running in parallel and I don't believe that they do but I have had similar problems and upon closer inspection determined that I have introduced some state dependencies. Anyway, the solution for me was to use Setup and Teardown (Nunit things) code to make sure state was setup correctly for each test that I ran. That just might work for you too.

    .NET (Core and Framework) sysadmin question help

  • sdk
    K keith maddox

    Sorry but I'm having a hard time understanding the question but here goes. If the question is can I use an SDK and or an API in VC6, the answer is a qualified yes. And no they are not the same but similar to some extent. Generally an SDK will contain an API along with a set of tool or utilities to help the developer. An API is kind of nebulous but generally is a public interface and a set of accompanying documentation. The API will need to have c calling convention in order to use it in VC6 and the SDK asssuming it is for the same purpose as the API you are refering, is just a superset of the API in that it will contain some additional tools, possible new APIs etc. If this was not helpfull then please give me a specific example of what API and SDK you are refering to and I'll give it another shot.

    IT & Infrastructure json

  • XML Documents - The height of laziness
    K keith maddox

    I'm not sure if I can fully answer your question but I would like to say that I am doing the same thing and I DO GET these warnings when methods, properties, basically anything protected or public is not commented. Are you using 2003?

    Visual Studio visual-studio csharp xml help question

  • tactDatagrid with VB.net and SQL
    K keith maddox

    If I understand your problem correctly, I think what you want to do is make a new adapter with a query something like the following (use you immagination since I don't know your schema) select x,y,z from mytable where x = someNameHere In otherwords, use a different adapter when you want to pull up just specific info. Probably too vague on my part but I need more specifics from you.

    Database csharp css database help

  • Help -- Tool Bar Control
    K keith maddox

    Use the Tag property for each button. Then query this value in the form with either with a switch statement or if-else-endif type of construct.

    C# help tutorial

  • Highlight listbox item on mouseover
    K keith maddox

    If you've not already found a solution, try looking at the OnMouseMove event. Are you trying to give feedback for any control on a form as the user moves from one to the other or are you trying to do this within a specific control, like a ListView or ListBox?

    C# tutorial question

  • How to set diffrent words in a label with diffrent fonts
    K keith maddox

    You can do just what you want in your paint method but you'll need to get a little more involved that you might want to. Basically what you need to do is paint the text of your control yourself. You'll notice that DrawString has a parameter for the font. Just use that and draw the string in sections, one for each font you are using. This also means that you'll need to use MeasureString for each piece as you draw it so you can get the next section to align to the proper place following the preceeding piece. Hope that makes sense.

    C# html tutorial

  • Add thousand separator and keep decimal precision
    K keith maddox

    If I understand you question, then I think you've got your nfi.NumberDecimalSeperator and your ndi.NumberGroupSeperator contents backwards. Try switching the two assignments around and see if that helps.

    C# question

  • My EllipseLabel - wrapping text question
    K keith maddox

    Hi, you can use MeasureString to give you the length of the string in drawing units (pixels) and compare the width of your control - border (or just client width if there is not an NC portion). Then of course, just extend the height of your control by the height of the current font, split, and wrap the line. You can get the font height with the Font property and call its Height property but make sure you use your graphics object's MeasureString method to get the length of the string in question. hope that is enough detail for you, if not let me know and i'll try to help further.

    C# graphics question tutorial
  • Login

  • Don't have an account? Register

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