Detect Double Right Mouse Click (VB.NET)

Simple Black Ops 2 countdown timer that’s triggered/dipslayed when the user double right-clicks the status bar in an application.  #easteregg

[vbnet]

Private Sub StatusStrip1_MouseDoubleClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles StatusStrip1.MouseDoubleClick
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim dt_BO2Launch As Date = “11/13/2012 00:00:00”
Dim tspan As TimeSpan = dt_BO2Launch.Subtract(Now)
MessageBox.Show(tspan.Days & “:” & tspan.Hours & “:” & tspan.Minutes & “:” & tspan.Seconds & vbCrLf & “DD:HH:MM:SS”, “Time until Black Ops 2 Launch!”, MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
End If
End Sub

[/vbnet]

Password Mask an unbound TextBox column in a DataGridView (VB.NET)

If you have ever wanted to mask the contents in a TextBox column on a DataGridView (DGV) control, you will notice that there is no pre-defined “password” format that you can apply.  I have gotten around this by setting the DataPropertyName attribute of the column and then checking the related property in the CellFormatting event.  It’s actually pretty simple and doesn’t involve very much coding at all!

DataPropertyName = "password"

DataPropertyName = "password"

After you have set the DataPropertyName for the related column(s) in your DGV, you need to add code that will evaluate this property when the data is loaded.  For this, I will use the CellFormatting event.

Before we begin, I want to set the character that will be displayed instead of actual value.  For this, I will use an asterisk (*).

Private pwd As Char = “*”

In the below example, my DataGridView is named dg_Divisions.  This routine will store the value of any field with the DataPropertyName of “password” into the related cell’s Tag property and will change each character in the Value to an asterisk.  If the field is not a “password” field, it will set the Tag to Nothing (null).

Private Sub dgv_PwdFormatting(ByVal sender As Object, ByVal e As DataGridViewCellFormattingEventArgs) Handles dg_Divisions.CellFormatting
If dg_Divisions.Columns(e.ColumnIndex).DataPropertyName = “passwordAnd e.Value <> Nothing Then
dg_Divisions.Rows(e.RowIndex).Tag = e.Value
e.Value = New String(pwd, e.Value.ToString.Length)
Else
dg_Divisions.Rows(e.RowIndex).Tag = Nothing
End If
End Sub
After the Tags and Values have been changed, we want the user to be able to see and modify the value if they begin editing the cell.  To do this, I will use the EditingControlShowing event.
Private Sub dgv_PwdEditing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles dg_Divisions.EditingControlShowing
If (dg_Divisions.CurrentRow.Tag <> Nothing) Then
e.Control.Text = dg_Divisions.CurrentRow.Tag.ToString()
End If
End Sub
Value displayed as asterisks

Value displayed as asterisks

Editing the cell displays the underlying contents

Editing the cell displays the underlying contents

That’s all there is to it!  Happy coding!

Double Layer Pumpkin Cheesecake

This is a super-easy and omnomable holiday no-bake dessert!  Also, many of the ingredients can be substituted for their light or fat free counterparts to help keep waistlines under control during the holiday season.  Enjoy!

Ingredients

  • 4 oz. cream cheese (softened)
  • 1 tbsp. milk
  • 1 tbsp. sugar
  • 1 tub (8 oz) Cool Whip
  • 1 prepared graham cracker crust (6 oz)
  • 1 cup cold milk
  • 1 can (15 oz) pumpkin
  • 2 pkg. (4-serving size) JELL-O Instant Vanilla Flavor Pudding & Pie Filling
  • 1 tsp. ground cinnamon
  • 1/2 tsp. ground ginger
  • 1/4 tsp ground cloves

Cheesecake Layer

  • Mix cream cheese, 1 tablespoon milk and sugar in large bowl with wire whisk until smooth.  (Hint: soften cream cheese in microwave on HIGH for 20 seconds)
  • Gently stir in 1 1/2 cups of the Cool Whip.
Cheesecake Mixture

Cheesecake Mixture

  • Spread onto bottom of crust.
Cheesecake Layer

Cheesecake Layer

Pumpkin Layer

  • Pour 1 cup milk into large mixing bowl
  • Add pumpkin, pudding mixes, and spices
Pumpkin Mix

Pumpkin Mix

  • Blent until well mixed (mixture will be thick)
Pumpkin Mix Mixed

Pumpkin Mix Mixed

  • Spread over the cheesecake layer
Pumpkin mixture on top of cheesecake layer

Pumpkin mixture on top of cheesecake layer

Finished Product!  Om nom nom!

Finished Product! Om nom nom!

Refrigerate 4 hours or until set.  Garnish with remaining whipped topping.  Store leftover pie in refrigerator.

Recipe compliments of the JELL-O company