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
X

Xint0

@Xint0
About
Posts
5
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 3D Bitmaps
    X Xint0

    It's actually "Veni, vidi, vici" :-D

    - Xint0

    Algorithms help graphics algorithms question

  • Specify comboboxcolumn for bound datatable column
    X Xint0

    Yes there is. Use the DataGridView designer to modify the properties for the column. Also try using a BindingSource (bound to your DataSet) as the data source for the DataGridView. That way you can bind the DataGridView rows to one table and the ComboBoxColumn drop-down to another table easily through the designer.

    - Xint0

    C# question

  • PropertyInfo SetValue doesn't work for custom objects.
    X Xint0

    Matt Casto wrote:

    If you run the sample code, you might notice that the SetValue doesn't even call the implicit conversion from string to CustomThing.

    That's because SetValue uses Object type for the value. Try adding an implicit conversion from Object to CustomThing.

    - Xint0

    C# help career

  • keypress to include the back space
    X Xint0

    Try this:

    ...
    If (e.KeyChar < '0' Or e.KeyChar > '9') And e.KeyChar <> '\b' Then
    ...

    Additionally if using .NET 2.0 probably it would be better if you used PreviewKeyDown event:

    Private Sub num_PreviewKeyDown(ByVal sender As Object, e As PreviewKeyDownEventArgs)
    e.IsInputKey = ((e.KeyCode = Keys.Back) And (e.Modifiers = 0)) Or ((e.KeyCode >= Keys.D0 Or e.KeyCode <= D9 Or e.KeyCode >= Keys.NumPad0 Or e.KeyCode <= Keys.NumPad9) And (e.Modifiers = 0))
    End Sub

    This way you can handle key combinations like Alt + 0, Ctrl + Backspace, etc. If using .NET 1.1 then use KeyDown to set a flag and check the flag value on the KeyPress event to set the Handled property.

    - Xint0

    Visual Basic help

  • how to make a faster algorithm
    X Xint0

    How about using a hash-table for the counters and forget about the nested loops. Assuming you are doing this with .NET 2.0, here's my take on this:

    private string DoCount(string input)
    {
        string alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890\u0027\u002E\u002C\u003A\u003B\u003F\u0021\u0023\u0028\u0029";
    // create hash-table for counters, set initial capacity to number of counters (characters in alphabet).
        Dictionary counters = new Dictionary(alphabet.Length); 
    //initialize just to be safe:
        foreach(char c in alphabet)
            counters[c] = 0;
    //count the characters in the input string:
        foreach(char c in input)
            if(counters.ContainsKey(c))
                counters[c]++;
    //now output statistics
        string output = string.Empty;
        for (int i = 0; i < alphabet.Length; i++)
        {
            flost percent = 0.0F;
            char c = alphabet[i];
            int count = counters[c];
            if(count > 0)
                 percent = (float)count / input.Length;
            output += string.Format("Letter {0} is displayed {1} times.  It is {2:P2} of the whole text.{3}", c, count, percent, Environment.NewLine);
        }
        return output;
    }
    

    Hope it works for you. :-D -- modified at 22:56 Thursday 26th October, 2006

    - Xint0 :cool:

    Algorithms question algorithms help tutorial workspace
  • Login

  • Don't have an account? Register

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