List(T).RemoveAll(match as System.predicate) Remove from IEnumerable possibly based on match
09-Nov-1010 Leave a comment
Useful
Would encourage more use of List(of )
IT and business subjects
09-Nov-1010 Leave a comment
Useful
Would encourage more use of List(of )
12-Oct-1010 1 Comment
Check all textbox or other controls with bindings.
Did you set the value of one programmatically to wrong format. E.g. Number binding, but text put in.
Bindingsource row will remain rowstate.detached until resolved.
03-Oct-1010 Leave a comment
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
SetConnectionStrings()
End Sub
Private Sub SetConnectionStrings()
Dim sConString As New SqlConnectionStringBuilder
sConString.MultipleActiveResultSets = True
sConString.IntegratedSecurity = True
Select Case My.Computer.Name.ToUpper
Case “Computer1”
sConString.DataSource = My.Computer.Name
Case “Computer2”
sConString.DataSource = My.Computer.Name ‘+ “\SQLEXPRESS”
Case Else
sConString.DataSource = “<your server name>”
End Select
My.Settings.conStringSettings = New System.Configuration.ConnectionStringSettings
My.Settings.conStringSettings.ProviderName = System.Data.SqlClient
sConString.InitialCatalog = “<your initial catalog>”
My.Settings.<name of saved system.configuration.connectionstringsettings>.ConnectionString = sConString.ConnectionString
My.Settings(<name of saved connection setting) = sConString.ConnectionString
Global.<referenced assembly name>.My.MySettings.Default(“<name of saved connection setting>”) = sConString.ConnectionString
‘MessageBox.Show(Global.BC.My.MySettings.Default.conStrSOP)
End Sub
25-Aug-1010 Leave a comment
02-Feb-1010 Leave a comment
Private Sub DecisionBindingSource_AddingNew(ByVal sender As System.Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles DecisionBindingSource.AddingNew
Try
Dim dNew As New Decision
dNew.DateInput = Today
dNew.IsNew = True
dNew.StatusID = Decision.StatusIDEnum.Current
'Lambda
Dim dList As IList(Of Decision) = CType(DecisionBindingSource.DataSource, IList(Of Decision))
dNew.ID = dList.Max(Function(d) d.ID) + 1
e.NewObject = dNew
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
02-Feb-1010 Leave a comment
02-Feb-1010 Leave a comment
Taken from MSDN Link Here but adjusted to make abstract
Private Sub SetupDGVComboBoxToEnum()
SetupDGVComboBoxColumnToEnumType(GetType(Decision.StatusIDEnum))
DGVColumnStatusID.DataPropertyName = "StatusID"
DGVColumnStatusID.Name = "Status"
End Sub
Private Sub SetupDGVComboBoxColumnToEnumType(ByVal enumType As Type)
DGVColumnStatusID.DataSource = [Enum].GetValues(enumType)
End Sub
02-Feb-1010 Leave a comment
Private mruList As IList(Of T)
Private Sub MRUAdd()
If mruList.Contains(Me.cPadMain) Then
mruList.Remove(Me.cPadMain)
End If
'Lambda
If mruList.Where(Function(m) m.ID = cPadMain.ID).Count = 0 Then
mruList.Insert(0, Me.cPadMain)
End If
MRUDisplay()
End Sub
Private Sub MRUDisplay()
MRUToolStripDropDownButton.DropDownItems.Clear()
'LINQ
Dim MRU As IEnumerable(Of PadMain) = From pm In mruList Order By pm.PadMaterial Descending
For Each pm As PadMain In MRU
Dim tsi As New ToolStripMenuItem
tsi.Tag = pm.ID
tsi.Text = pm.Pad + " in " + pm.Material.Material + " " + pm.ID.ToString
MRUToolStripDropDownButton.DropDownItems.Insert(0, tsi)
If MRUToolStripDropDownButton.DropDownItems.Count > 10 Then
Exit For
End If
Next
End Sub
02-Feb-1010 Leave a comment
Dim EntityConnectionString = Configuration.ConfigurationManager.ConnectionStrings(“SOPEntities”).ConnectionString
context = New BC.SWT.EntityModel.SOPEntities(EntityConnectionString)
Dim CustomerQuery AsObjectQuery(OfCustomer) = context.Customers
Dim results = From a In CustomerQuery Select a.CustomerID, a.Customer1 OrderBy Customer1