Edit and Continue: Changes are not allowed when the debugger has…

 
Edit and Continue
Changes are not allowed when the debugger has been attached to an already running process or the code being debugged was optimized at build or run time
 
Probably more than one issue:
  1. Check that running in Debug mode

 

Find Text in File

Technorati Tags: ,
 

Private Function IsTextInFile(ByVal MyDir As String, ByVal TextToFind As String, ByVal MyFileWildcard As String) As Boolean

Dim list As System.Collections.ObjectModel.ReadOnlyCollection(Of String)
list =
My.Computer.FileSystem.FindInFiles(MyDir, TextToFind, True, FileIO.SearchOption.SearchTopLevelOnly, MyFileWildcard)

If list.Count = 1 Then
IsTextInFile = True
End If

End Function

Bind a Combo or ListBox to an Enumeration

While this works, most Enum are in Camel case and do not have spaces, which may not be what you want

ComboBox1.DataSource = System.Enum.GetValues(GetType(PeopleNames))

Dim nameid As PeopleNames = CType(ComboBox1.SelectedValue, PeopleNames)

Note there should be no need to set the DisplayMember. If it does not work check that you have nothing on the control > DataBindings > Text binding

The variable “nameid” contains a 0, or 1, or 2 etc. depending on the value of the enumerated item that is currently selected.

May also bind to VS enumerations. Good use would be to bind to

ListBoxChartType.DataSource = System.Enum.GetValues(GetType(System.Windows.Forms.DataVisualization.Charting.SeriesChartType))

 

sender Is (control) with Option Strict On

 
Select Case True
    Case sender Is PrintPreviewToolStripMenuItem, sender Is PrintPreviewToolStripButton
 
From
You can use Select Case as in the following:

Select Case True
   Case sender Is TextBox1
      Label1.Text = TextBox1.Text
  
Case sender Is TextBox2
      Label1.Text = TextBox2.Text
End Select

However, this translates into IL (and decompiled using Reflector) as:

 Dim flag1 As Boolean = True
      If (flag1 = (sender Is Me.TextBox1)) Then
            Me.Label1.Text = Me.TextBox1.Text
      Else
            If (flag1 = (sender Is Me.TextBox2)) Then
                  Me.Label1.Text = Me.TextBox2.Text
            End If
      End If

I don’t know if this helps.

METHOD How to set a Local Report Parameter

 

They said it could not be done.
But here is the code to set a Local Report Parameter at runtime

”’ <summary>
”’ METHOD How to set Report Parameter
”’ </summary>
”’ <param name="MyReportViewer"></param>
”’ <param name="sParameterName"></param>
”’ <param name="sParameterText"></param>
”’ <remarks></remarks>

Private Sub SetLocalReportParameter(ByVal MyReportViewer As Microsoft.Reporting.WinForms.ReportViewer, ByVal sParameterName As String, ByVal sParameterText As String)

Try
Dim rp As New ReportParameter(sParameterName, sParameterText)
Dim rpP() As ReportParameter = {rp}
With MyReportViewer
.LocalReport.SetParameters(rpP)
.RefreshReport()
End With

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try

End Sub

Report does not refresh with BindingSource Filter

 
For a local report, where you want to refresh based on the BindingSource. See this link.
 
 
Required code is
 
Dim tempBindingSource As New BindingSource(Me.OriginalBindingSource, "")
Me.ReportViewer1.LocalReport.DataSources(0).Value = tempBindingSource
 
Steve

Late Binding when reference not available E.g. Excel

VB.Net Starter