Category: vb.net

Jun 03 2014

Which DataGridView event do I use when I want to change the type of a cell at runtime?

        <p>I have a winform application that has a user control that is using a DataGridView control on it. </p>

When rendering the DataGridView I want some of the rows Quantity columns cells to be read only DataGridViewTextBox cells and other rows to a a DataGridViewComboBoxCell.

What is the appropriate DataGridView event to use this. CellFormatting or CellPaint or some other event?

Jun 03 2014

Which DataGridView event do I use when I want to change the type of a cell at runtime?

I have a winform application that has a user control that is using a DataGridView control on it.

When rendering the DataGridView I want some of the rows Quantity columns cells to be read only DataGridViewTextBox cells and other rows to a a DataGridViewComboBoxCell.

What is the appropriate DataGridView event to use this. CellFormatting or CellPaint or some other event?

Sep 26 2013

Weird behavior when opening web project in Visual Studio 2012

        <p>I have a solution with a web project (the "main" project - lets call it the DataPortal project.) where the project will not open unless take the following steps.</p>
  1. Open solution. The DataPortal project is greyed out and says "Unable to open project".
  2. Right click the DataPortal project node and choose Edit DataPortal.vbproj
  3. Change the UseIIS node in the project from True to False. Save the file.
  4. Right click the DataPortal project and choose Load Project. The project loads.
  5. Now open the DataPortal project files Property page. (Alt-Enter)
  6. Check the option button in the Property sheet that says Use Local IIS Web Server.
  7. Check the checkbox that says Use IIS Express. The Project Url already has a value in it.
Now everything works great. And I can work until I shut down VS but when I re-open the solution I have to go back through it all again. Can anyone tell me how to fix it so that UseIIS is okay at startup? Is there some way to get insight into the project load error for more information about it?
Jul 23 2012

Do you have to call EndInvoke (or define a callback ) for asynchronous method calls even if you don’t have anything to do when it returns

I found the following code snippet on CodeProject on calling methods asynchronously at ... http://www.codeproject.com/Articles/14931/Asynchronous-Method-Invocation
private void CallFooWithOutAndRefParameters()
{
    // create the paramets to pass to the function
    string strParam1 = "Param1";
    int intValue = 100;
    ArrayList list = new ArrayList();
    list.Add("Item1");

    // create the delegate
    DelegateWithOutAndRefParameters delFoo =
      new DelegateWithOutAndRefParameters(FooWithOutAndRefParameters);

    // call the beginInvoke function!
    IAsyncResult tag =
        delFoo.BeginInvoke(strParam1,
            out intValue,
            ref list,
            null, null);

    // normally control is returned right away,
    // so you can do other work here...

    // calling end invoke notice that intValue and list are passed
    // as arguments because they might be updated within the function.
    string strResult =
        delFoo.EndInvoke(out intValue, ref list, tag);

    // write down the parameters:
    Trace.WriteLine("param1: " + strParam1);
    Trace.WriteLine("param2: " + intValue);
    Trace.WriteLine("ArrayList count: " + list.Count);
    Trace.WriteLine("return value: " + strResult);
}
There are a couple of things I don't understand about this code. Per the comment control is returned immediately to the calling code when it hits the BeginInvoke line. Does that mean that the code that follows (EndInvoke followed by some trace logging) only runs after the FooWithOutAndRefParameters call completes...automagically (even though that code resides in the same method). It looks a little confusing to me. (I have always used callbacks for this kind of thing.) Using this method do I HAVE to call EndInvoke. Can I just invoke the method asyncronously and forget it happened? Any downsides to this? If I don't call EndInvoke (as is shown in this method) should I then always have a callback? Even if the callback does nothing. If the answers YOU SHOULD...then do you call EndInvoke OR define a callback? (The advantage to defining a callback being that you are notified of the result) BTW I know I could check for errors or log resuls in the EndInvoke or callback (and I might in fact do that). What I was wondering is ARE THERE RISKS from not calling EndInvoke or defining a callback (memory leaks for example)? What is the best practice. Seth
May 03 2012

How do I troubleshoot Visual Studio which is hanging when loading ASP.NET MVC project?

Yesterday I worked on an MVC 3 project in Visual Studio 2010 and then shut down Visual Studio before leaving work.

This morning when I try to load the same project in Visual Studio the project hangs. I have restarted my computer, disabled all add-ons and extensions that I could. Still no banana.

I have no idea how to troubleshoot this. I would try to clean the solution if I could get it to load but I can't. (Can I clean the solution from the VS command window?).

Any help would be greatly appreciated. How do I troubleshoot this?

Seth

May 03 2012

How do I troubleshoot Visual Studio which is hanging when loading ASP.NET MVC project?

Yesterday I worked on an MVC 3 project in Visual Studio 2010 and then shut down Visual Studio before leaving work.

This morning when I try to load the same project in Visual Studio the project hangs. I have restarted my computer, disabled all add-ons and extensions that I could. Still no banana.

I have no idea how to troubleshoot this. I would try to clean the solution if I could get it to load but I can't. (Can I clean the solution from the VS command window?).

Any help would be greatly appreciated. How do I troubleshoot this?

Seth

Jan 13 2011

How come the .NET framework 3.5 offline installer is 200 MBs larger than the .NET 4 offline installer?

Hello,

I have code/support an application built on .NET framework that has always run on .NET 2. This year we are upgrading the application to use .NET 3.5 (or 4?).

In preparing for this change we noticed that that Offline Installer (required for our customer base) for .NET 3.5 is 200+ MBs bigger than the .NET 4 offline installer.

Here are my questions.

Why is the dotnet 3.5 installer so much bigger than the 4 offline installer?

Can we TARGET .NET 3.5 but distribute .NET 4. In other words, is .NET 4 backwards compatible? Assuming that .NET 4 was the only installed .NET could application still target earlier frameworks?

IF our application is compiled for x86 CPU (rather than Any CPU) do you still have to distribute the x64/x86 Client Profile or can we just distribute the x86 Client Profile? In other words, can we distribute the x86 Client Profile even though it will be installed on x64 machines if our app is compiled for x86 target CPU? Any risks or gotchas for doing this?

The issue is that if we upgrade our app to target .NET 4 there are a lot of application servers that we also have to upgrade which effects a number of other applications. Any thoughts?

Seth

Jan 13 2011

How come the .NET framework 3.5 offline installer is 200 MBs larger than the .NET 4 offline installer?

I have code/support an application built on .NET framework that has always run on .NET 2. This year we are upgrading the application to use .NET 3.5 (or 4?).

In preparing for this change we noticed that that Offline Installer (required for our customer base) for .NET 3.5 is 200+ MBs bigger than the .NET 4 offline installer.

Here are my questions.

Why is the dotnet 3.5 installer so much bigger than the 4 offline installer?

Can we TARGET .NET 3.5 but distribute .NET 4. In other words, is .NET 4 backwards compatible? Assuming that .NET 4 was the only installed .NET could application still target earlier frameworks?

IF our application is compiled for x86 CPU (rather than Any CPU) do you still have to distribute the x64/x86 Client Profile or can we just distribute the x86 Client Profile? In other words, can we distribute the x86 Client Profile even though it will be installed on x64 machines if our app is compiled for x86 target CPU? Any risks or gotchas for doing this?

The issue is that if we upgrade our app to target .NET 4 there are a lot of application servers that we also have to upgrade which effects a number of other applications. Any thoughts?

Seth

Nov 29 2010

Will Try / Finally (without the Catch) bubble the exception?

I am almost positive that the answer is YES. If I use a Try Finally block but do not use a Catch block then any exceptions WILL bubble. Correct?

Any thoughts on the practice in general?

Seth

Nov 29 2010

Will Try / Finally (without the Catch) bubble the exception?

I am almost positive that the answer is YES. If I use a Try Finally block but do not use a Catch block then any exceptions WILL bubble. Correct?

Any thoughts on the practice in general?

Seth