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
D

DigitalKing

@DigitalKing
About
Posts
84
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Wish me luck
    D DigitalKing

    Good luck. I was way over-prepared for that test. And my examiner was very nice. I'm sure you'll do just fine. :)

    The Lounge csharp com question

  • Any one use google webmaster tools?
    D DigitalKing

    Yes - after you validate them, make sure you don't delete the blank html file from your webserver or remove the meta tag. Every once in a while, Google seems to revalidate your site.

    The Lounge csharp com tools question

  • HELP!!!!! Hurry, Now.
    D DigitalKing

    I've also encountered this, but the power supply (the 12V part) was dead. I would try it with a different power supply.

    The Lounge adobe testing beta-testing help question

  • Weird Quotient test
    D DigitalKing

    Warm and fuzzy.:rolleyes::cool:

    The Lounge php com question

  • Weird Quotient test
    D DigitalKing

    165 0% are more weird, 0% are just as weird, and 100% are more normal than you! I had to try... http://www.nerdtests.com/thetester/images/php/wq.php?val=8495

    The Lounge php com question

  • Finding File Paths from string
    D DigitalKing

    Use Regular Expressions: using System.Text.RegularExpressions; ... //Find all paths in the string MatchCollection matches = Regex.Matches(richTextBox1.Text, "\\b[a-z]\\:(\\\\[^\\n\\r\\f\\t\\\\/<>|\":*?]+)*\\b", RegexOptions.IgnoreCase); foreach (Match m in matches) { //do whatever you need to for each path found in the string. The entire path can be found using m.Value //you can also find the index and length of the path in the string by accessing other fields of m. } Hope this helps, DigitalKing

    C# help

  • How to Exit Nested Methods
    D DigitalKing

    void event1(...) {
    //this event is called first
    if (method1())
    {
    //more stuff
    }
    }

    public bool method1() {
    //some stuff
    if (!method2()) return false;
    //more stuff
    return true;
    }

    public bool method2() {
    //some stuff
    if (!method3()) return false;
    //more stuff
    return true;
    }

    public bool method3() {
    //some stuff
    if (x == 0) {
    return false;
    }
    //more stuff
    return true;
    }

    C# tutorial question help

  • how to get browser histry in c#.net
    D DigitalKing

    Check out this article[^]

    C# csharp help tutorial

  • Multiple Icons in Icon File
    D DigitalKing

    Try this tool: IconArt[^] It's free for personal use, and $10 for commercial use.

    C# question visual-studio regex help

  • Text file Sorting.
    D DigitalKing

    What's the problem? Are you sorting it numerically or alphabetically? Line by line? Please be more specific.

    C# help algorithms

  • improve the application response speed
    D DigitalKing

    Use a seperate thread for the video and audio capture (if you aren't already). This will free up the GUI thread, and should improve response time.

    C# winforms performance code-review

  • Few focused questions
    D DigitalKing

    There's no good way to accomplish this, as it is the user's preference. For example, in firefox, the user can select whether to load newly opened pages in the current tab, or a new tab.

    C# question csharp security

  • Sudoku?
    D DigitalKing

    http://www.codeproject.com/info/search.asp?cats=3&searchkw=sudoku[^]

    C# csharp game-dev tutorial question

  • Few focused questions
    D DigitalKing

    1. Create some registry entries under HKEY_CLASSES_ROOT:

    This can all be done programatically, but it takes some work. Look at the Microsoft.Win32 namespace for registry manipulation functions.

    1. Create a key by the name of the file extension you want
    2. Set the default attribute of this key to a word that describes your program. It's name doesn't really matter.
    3. Create a key by the name of the word you decided on in step 2.
    4. Create some subkeys: 'DefaultIcon' and 'shell'
    5. Set the default attribute of the DefaultIcon key to the path of your icon. If you want to use the the same icon
      as your executable, do something like this: c:\code\mysupercoolapp\exefile.exe,0
    6. Create a 'open' subkey under 'shell' and a 'command' subkey under open
    7. Set the default attribute of the 'command' key to the path of your program (include the %1) c:\code\mysupercoolapp\exefile.exe %1
    8. Restart
    9. When a file with the extension you've picked is double-clicked, your application will run.
      The first argument will be the path of the file.

    2. You can put a link in the startup folder of the start menu, or add a registry entry to either HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run (if you want it to run whenever the computer starts) or HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run (if you want it to run whenever only the current user logs on) 3. As the other post-er said, search for "single instance" 4. System.Diagnostics.Process.Start("http://www.myurl.com"); will open the url in the default web browser 5. I should read up on cryptography 6. They are in a zip file in Visual Studio's program folder: C:\Program Files\Microsoft Visual Studio 8\Common7\VS2005ImageLibrary\VS2005ImageLibrary.zip (or similar) Hope this helps, DigitalKing

    C# question csharp security

  • contro with custom properties
    D DigitalKing

    You have to use fields, you cannot just make variables public: This will not work:

    public int MyInteger=1;

    This will:

    private int myInteger=1;

    public int MyInteger
    {
    get
    {
    return myInteger;
    }
    set
    {
    myInteger=value;
    }
    }

    If you want variables to be read only, just omit the set accessor:

    private int myInteger=1;

    public int MyInteger
    {
    get
    {
    return myInteger;
    }
    }

    You can adjust the visible attributes in the property designer:

    private int myInteger=1;

    [Description("A useless number."),Category("Behavior")]
    public int MyInteger
    {
    get
    {
    return myInteger;
    }
    set
    {
    myInteger=value;
    }
    }

    Hope this helps, DigitalKing

    C# question csharp visual-studio

  • C# equivalent to char * (well, System.IntPtr)??
    D DigitalKing

    Which API function are you using? You can probably use the StringBuilder class (from System.Text), and (depending on the function) replace the IntPtr argument with one of type StringBuilder.

    C# csharp help c++ json performance

  • Convert a file to stream
    D DigitalKing

    This is a good way, but the FileInfo object is not necessary (unless you are using it somewhere else). Try this:

    Stream sm = new FileStream(@"C:\test.wav", FileMode.Open);

    Hope this helps, DigitalKing

    C# tutorial question

  • get active program window
    D DigitalKing

    Try this:

    [DllImport("user32.dll")]
    private static extern IntPtr GetForegroundWindow();

    DigitalKing

    C# question json

  • Drag And Drop
    D DigitalKing

    You are correct. Do something like this:

    public Form1()
    {
    InitializeComponent();
    richTextBox1.DragEnter += new DragEventHandler(richTextBox1_DragEnter);
    richTextBox1.DragDrop += new DragEventHandler(richTextBox1_DragDrop);
    }

    void richTextBox1_DragDrop(object sender, DragEventArgs e)
    {
    string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); //array of the full paths of all files that were dropped
    if (files.Length > 0)
    {
    try
    {
    System.IO.StreamReader r = new System.IO.StreamReader(files[0]);
    richTextBox1.Text = r.ReadToEnd();
    }
    catch (Exception ex)
    {
    System.Diagnostics.Debug.WriteLine("Error opening file " + files[0] + ":\n"+ex.Message);
    }
    }
    }

    void richTextBox1_DragEnter(object sender, DragEventArgs e)
    {
    if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
    {
    e.Effect = DragDropEffects.All;
    }
    }

    Hope this helps, DigitalKing

    C# question

  • ComboBox problem windows application
    D DigitalKing

    This happens because when the combobox is populated, the first item is automatically selected, and therefore, the SelectedIndexChanged event is called. Use a boolean flag to prevent this from happening:

    bool AllowSelectedIndexChange = true;

    void Form1_Load()
    {
    ...
    AllowSelectedIndexChange=false;
    combobox1.DataSource = arr;
    AllowSelectedIndexChange=true;
    ...
    }
    void ComboBox1_SelectedIndexChanged(...)
    {
    if (AllowSelectedIndexChange)
    {
    //current SelectedIndexChanged code goes here
    }
    }

    Hope this helps, DigitalKing

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