About Rod

Rod Stephens picture

Rod Stephens started out as a mathematician, but while studying at MIT, he discovered how much fun algorithms are. He took every algorithms course MIT offered and has been writing complex algorithms ever since.

During his career, Rod has worked on an eclectic assortment of applications in such fields as telephone switching, billing, repair dispatching, tax processing, wastewater treatment, concert ticket sales, cartography, and training for professional football players.

Rod has been a Microsoft Visual Basic Most Valuable Professional (MVP) for more than 10 years, and has taught introductory programming at ITT Technical Institute. He has written more than 2 dozen books that have been translated into languages from all over the world. He has also written more than 250 magazine articles covering C#, Visual Basic, Visual Basic for Applications, Delphi, and Java.

Rod’s popular VB Helper web site receives several million hits per month and contains tips, tricks, and example programs for Visual Basic programmers. His C# Helper web site (www.csharphelper.com) contains similar material for C# programmers.

You can contact Rod at RodStephens@CSharpHelper.com.

26 Responses to About Rod

  1. NAMANE SARA says:

    hello ;
    i have a question about an article but i can’t contact you using contact us because i can’t install the Really Simple CAPTCHA plugin, how can i contact you.
    Regards

    • RodStephens says:

      You can leave a message here or on a post, or email user name RodStephens at this web site.

      • VETRI says:

        Dear Sir, I have to display uploaded file (image/pdf/word/excel) in datagridview. If i click that link the file should be downloaded from the uploaded folder.(File moves to the local folder & File path saved in database). Please check my below code…

        if (dt.Rows.Count > 0)
        {
            dataGridView.AutoGenerateColumns = false;
            dataGridView.ColumnCount = 3;
        
            dataGridView.Columns[0].HeaderText = "Customer Id";
            dataGridView.Columns[0].DataPropertyName = dt.Columns["id"].ToString();
        
            dataGridView.Columns[1].HeaderText = "Accident Date";
            dataGridView.Columns[1].DataPropertyName = "accidentdate";
        
            DataGridViewImageColumn FileUpload1 = new DataGridViewImageColumn();
            FileUpload1.HeaderText = "File Upload-1";
            FileUpload1.ImageLayout = DataGridViewImageCellLayout.Zoom;
            FileUpload1.DefaultCellStyle.SelectionBackColor = Color.White;
            dataGridView.Columns.Add(FileUpload1);
        
            DataRow[] dr = new DataRow[dt.Rows.Count];
            dt.Rows.CopyTo(dr, 0);
            for (int i = 0; i < dr.Length; i++)
                foreach (DataRow dr in dt.Rows)
                {
                    strFileUpload1 = dr[i].Field("fileupload1");
                    extension = Path.GetExtension(strFileUpload1);
                    if (strFileUpload1 != string.Empty && strFileUpload1 != null)
                    {
                        switch (extension)
                        {
                            case ".pdf":
                                FileUpload1.Image = Properties.Resources.pdf;
                                break;
                            case ".doc":
                                FileUpload1.Image = Properties.Resources.word;
                                break;
                            case ".docx":
                                FileUpload1.Image = Properties.Resources.word;
                                break;
                            case ".xls":
                                FileUpload1.Image = Properties.Resources.excel;
                                break;
                            default:
                                FileUpload1.Image = Image.FromFile(strFileUpload1);
                                break;
                            }
                        }
                        else
                        {
                            FileUpload1.DefaultCellStyle.NullValue = null;
                        }
                    }
                }
        
            dataGridView.DataSource = dt;
            dataGridView.AllowUserToAddRows = false;
        }

        But in image column last row display in all the fields.. please help me..

        • RodStephens says:

          I’m not sure I understand, but I think the problem may be here:

          for (int i = 0; i < dr.Length; i++)
              foreach (DataRow dr in dt.Rows)

          The first loop runs over all of the rows and then the second loop also loops over all of the rows.

          Then inside the loop it looks like you're setting the image on the column. You probably want to set the image on the cell inside each row.

  2. Lawrence Bartel says:

    You have often shown algorithms for various tree structures and graphs. I’ve studied shortest path or maximum flow algorithms years ago. How do mapping or routing programs like Microsoft Mappoint or Garmin auto GPS store their data and calculate a route?

    • Lawrence Bartel says:

      Hold on… I just found your answer in your http://www.devx.com/dotnet/Article/38666 article. Thanks,

      • RodStephens says:

        I don’t know exactly which data structures and algorithms those sites and others use, but that article describes some of the more likely choices.

        They may also store pre-computed paths for at least some of the data, for example between major street and highway intersections. Or they may favor highways for longer paths. Then you can calculate a path from the start point to the nearest stored intersections, follow a pre-calcuated path to the stored intersections nearest to the destination, and finish by calculating a path from those to the destination. That can save a lot of time for really long paths like from Los Angeles to New York.

        There are lots of tweaks and modifications they might use.

  3. fatih says:

    hello. I am writing from turkey. I wrote using google translation.
    I want to save RichTextBox or TextBox using SQL to mathematical equations. Is something like this possible?

    • RodStephens says:

      Do you mean you want to write equations in a RichTextBox or TextBox and save the equation in SQL?

      If you can create the equation using Unicode, then you may be able to do that. A RichTextBox is a lot more powerful so it would be a better bet. For example, it can display subscripts and superscripts. You can probably also times, divide, square root, and other symbols in Unicode.

      But I don’t think you can do things like roots that actually go over the terms inside them. I also don’t think you can do vertical fractions, integrals, matrices, etc. So unless you can use very simple equations, no you can’t do this.

      Usually when I need an equation, I build it in Word, take a screen shot, and then save it as an image.

  4. Mohammed says:

    Hello
    I am Mohammed
    Hello
    I just bought C# 24-Hour Trainer, 2nd Edition. I tried to go to book web page videos http://www.wrox.com/go/csharp24hourtrainer2evdeos

    I get the message the :

    You Encountered the Following Error:
    Page Not Found

    /WileyCDA/redirect/go/csharp24hourtrainer2evdeos

    If you are looking for a specific product, you can go to the homepage and enter the information in the Search Titles box or begin browsing.

    Please contact our webmaster if you need more assistance.
    Could you please send the correct video link
    Regards

  5. NAMANE SARA says:

    Hello ;
    I have (value1, value2) as a result of a program on visual studio and I want to export these results to create a graphic in Excel, i have an exception and i cannot resolve it. This is my code
    private void InsertValuesIntoExcel(int note1, int note2)
    {
    string fileName = @”D:\test.xlsx”;
    string connectionString = String.Format(@”Provider=Microsoft.ACE.OLEDB.12.0;” +
    “Data Source={0};Extended Properties=’Excel 12.0;HDR=YES;IMEX=0′”, fileName);

    using (OleDbConnection cn = new OleDbConnection(connectionString))
    {
    cn.Open();
    if (first)
    {
    OleDbCommand cmd0 = new OleDbCommand(@”CREATE TABLE [RawData] ” +
    “([NOTEA] int, ” + “[NOTEB] int)”, cn);
    cmd0.ExecuteNonQuery();
    first = false;
    }
    OleDbCommand cmd1 = new OleDbCommand(“INSERT INTO [RawData$] ” +
    “([NOTEA],[NOTEB]) ” +
    “VALUES(@value1,@value2)”, cn);
    cmd1.Parameters.AddWithValue(“@value1”, note1);
    cmd1.Parameters.AddWithValue(“@value2”, note2);
    //cmd1.Parameters.Add(“@value1”, OleDbType.Integer).Value = note2;
    //cmd1.Parameters.Add(“@value2”, OleDbType.Integer).Value = note1;
    cmd1.ExecuteNonQuery();
    }
    i have excel 2007, and i use .Net Framework 4 and i have this exception
    The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine.

  6. Andrey says:

    Hi, Rod. I have a question about ellipse intersection.

    In these 2 articles i think
    http://csharphelper.com/blog/2014/11/calculate-the-formula-for-an-ellipse-selected-by-the-user-in-c/

    http://csharphelper.com/blog/2014/11/see-where-two-ellipses-intersect-in-c-part-2/

    you write conic section equation not properly. I explaint.
    in first article you wrote formula: Ax^2 + By^2 + Cxy, but
    in the next article you wrote A1x^2 + B1xy + C1y^2. Why so? Is it mistake ore not?
    And please explain i’ve tried to substitute these vars A = 1/Rx^2, B=1/Ry2, C=0, and so on in main formula from this article(http://csharphelper.com/blog/2014/11/see-where-two-ellipses-intersect-in-c-part-2/). But I think i’ve got bad results, because my B variable is zero.

    • RodStephens says:

      The most general form of a conic section is:

      Ax2 + Bxy + Cy2 + Dx + Ey + F = 0

      Depending on the value of B2 – 4AC you get an ellipse, circle, parabola, hyperbola, or some degenerate form such as a point or two lines. For example, see math2.org.

      The first example works with ellipses that have axes parallel to the X and Y axes. in those cases B is 0. If the ellipse is rotated, then B is not 0.

      Your result might be correct when B is 0 if the ellipses are parallel to the axes.

  7. Nick Hewett says:

    Hi Rod,

    I’m about to start my C# journey having been a VBA programmer for many years. Looking for web resources I stumbled across csharphelper.com.

    Wow, what a gold-mine! Just wanted to say thanks for making this available. I think I’m going to be a regular visitor and appreciative fan.

    • RodStephens says:

      Hi Nick. I hope you find the site useful. Be sure to tell your friends and coworkers. (The ones who might care πŸ˜‰

      You might want to start off with a book. You can certainly learn everything from the Internet, but a book can make things simpler. If you’ve worked with VBA a lot, then you should probably steer away from the “Idiot’s” and “Dummies” books. They’d be too easy.

      Good luck!

  8. Jason says:

    Rod,

    What is the license for the code you post on your blog? Is there a proper way to use one of your algorithms in free (GNU LGPL) software?

    • RodStephens says:

      You can use the code you find on this site or in my books. I request but don’t require an acknowledgement. I also recommend (but again don’t require) that you put the URL where you found the code in a comment inside your code in case you need to look it up later.

      So really no restrictions.

  9. Orel Naten says:

    visual c# application havey flickering on another machine.

    hello Rod, i wonder if you can help me…

    i have developed an application (game) on visual studio 2012 (WFA) in C#, the application includes multithreading, sounds, video and graphics objects (pictureboxs, bit maps, labels…).

    now the app runs great on the source pc (the computer it was developed on(desktop pc)). but when i try to run it on my laptop it’s run with very heavy flickering which is very weird. (95% cpu usage)

    source pc – Win 7, 32bit.
    laptop – Win 10, 64bit.

    I have already tried:
    *use the same frameworks on buth machines.
    *install VS and debug the game on the laptop.
    *use timers insted of threads.
    *use the Configuration Manager tool in VS to build a 32,64,86 bit version of the application on the laptop.
    *change the target framework in VS on the laptop. (i have tried all the frameworks list).

    nothing helps!!, my game still flickering on the laptop..so annoying! i can’t understand what is going on??

    tenxxx

  10. Orel Naten says:

    hii rod, thanks for the tips..

    note: “Maybe the laptop is too slow”, is not an option. in the past, i use to play on that laptop ‘call of duty 2’ with very good performance.

    Today, according to your advice i tried to use double bufffering and slowing down the timers and threads..unfortunately, without success πŸ™ , there was no improvement with the game performance, i can’t determine what is the problem..

    is it possible that Win 10 is the key?
    is there any known difference between cpu’s architecture of desktop pc to laptop pc?

  11. atif says:

    hi Rod,
    I am new in programming field.
    Any suggestion

    • RodStephens says:

      Kind of a broad question! πŸ˜‰

      Because you’re new to programming, I would suggest a beginner’s book. One of the “Dummies” or “Idiot’s” series. Or one of my beginner books (C# 24-Hour Trainer or Visual Basic Programming 24-Hour Trainer). Work through that book at the pace you find comfortable.

      After you finish the beginner’s book, you can move to a bigger book like my book C# 5.0 Programmer’s Reference. Or a “Professional” series book. Those books cover a lot more material in a lot more depth at a faster pace.

      Otherwise poke around the internet, look at examples (like those on my web sites), look at the questions people are asking in discussion groups, etc.

      I hope that helps.

  12. Mark says:

    Hi Rod,

    What an amazing collection of resources on offer here – very helpful. Thanks for making all this available!

Leave a Reply

Your email address will not be published. Required fields are marked *