Solved having to click twice to drop a DataGridViewComboBox

The default behaviour of a drop down combobox in a datagridview is for it to require one click to activate it and another to actually drop it down.

Users can’t get this paradigm and so prefer for it to activate immediately on clicking anywhere on the cell. I have seen many solutions on Stackoverflow for this, but most require the arrow part of the cell to be clicked, not working if the user just clicks the cell in the middle. 

image

I found the following solution to work for me:

Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) _
Handles DataGridView1.CellClick
If (e.ColumnIndex > 0) And e.RowIndex <> -1 Then
With DirectCast(sender, DataGridView)
If .Columns(e.ColumnIndex).Name = "PalletType" Then
.CurrentCell = .Rows(e.RowIndex).Cells(e.ColumnIndex)
.BeginEdit(True)
DirectCast(.EditingControl, _
System.Windows.Forms.DataGridViewComboBoxEditingControl).DroppedDown = True
End If
End With
End If
End Sub

This makes certain the column is not a header cell, and only does it for the column with the name “PalletType”

I also have the DatagridView set to EditOnEnter for the Edit mode.

image

WCF Service on Server 2012

The page you are requesting cannot be served because of the extension 
configuration. If the page is a script, add a handler. If the file should be 
downloaded, add a MIME map.

My first experiences with Server 2012 had me puzzled for a few mins when trying to get some WCF service end points transferred from another older 2003 server.

It was solved by going into server manager, drilling down in the add roles and features to the server concerned, selecting Features. under the .NET Framework 4.5 features there was WCF Services, after checking the box and under that also selecting HTTP Activation to on, everything sprang to life.

There are also 3.5 versions of these too if the application is running on the older framework.

image

More...

Progress messages from SQL Server to VB.NET/C# application

When executing long running queries on SQL server, the messages from PRINT statements do not return to the caller sometimes until the whole process is finished, or intermittently at best.

If running a long running process from the GUI or debugging in SQL server management studio, it can be desirable to let the user know where things are at and prevent them force quitting your application prematurely.

By using the following statement messages can be sent back immediately, note the NOWAIT, this forces the message back right away:

RAISERROR (N'working', 10,1) WITH NOWAIT

In the above example, 10 is the severity level of the error we are raising  and 1 the state. This is not severe enough to stop the statement running.

I use this all the time now for getting a feeling of security from seeing something happening on long running scripts.

ADO.NET

With C#/VB.NET using ADO.NET to connect to the procedure, we have a “infoMessage” event that is raised whenever a message comes back from SQL. By handling this event we can proceed to update the user GUI with that message, or another message as required.

cn.InfoMessage += delegate(object sender, SqlInfoMessageEventArgs e)
{
txtMessages.Text += "\n" + e.Message;
};

 

References: