ToolStripTextBox as Password

 

Can I make a ToolStripTextBox show a character if I am using it for a password ie a * instead of a character as you can in a textbox ? Yes

ToolStripTextBox1.TextBox.PasswordChar = "*"c

From http://vbcity.com/forums/topic.asp?tid=153131

 

Entity Framework – Connection Strings

Technorati Tags:

See:

http://msdn.microsoft.com/en-us/library/vstudio/cc716756(v=vs.100).aspx

Entity Framework connection string for Entity Model

If in a different project in the same solution and a folder in that project then.


res://Project.ProjectName/Folder.ModelName.csdl|
res://Project.ProjectName/Folder.ModelName.ssdl|
res://Project.ProjectName/Folder.ModelName.msl;

If you struggle then the following will work, but may not be as efficient because the application has to search through available references. This is all that is needed though.


res://*/

 

  <connectionStrings>
    <add name="MovieModel"
         connectionString="metadata=res://OneWay.EntityModel/Models.MovieModel.csdl|
                                    res://OneWay.EntityModel/Models.MovieModel.ssdl|
                                    res://OneWay.EntityModel/Models.MovieModel.msl;
                                    provider=System.Data.SqlClient;
                                    provider connection string=
                                      "data source=(local);
                                      initial catalog=DBName;
                                      integrated security=True;
                                      multipleactiveresultsets=True;
                                      App=EntityFramework;""
         providerName="System.Data.EntityClient" />

    <add name="OneWayEntitiesCF"
         connectionString="Data Source=(local);Initial Catalog=OneWay;Integrated Security=True"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

Error 1: System.IO.FileNotFoundException: Unable to resolve assembly ‘OneWay.EntityMode’.

Solution is to correct res://[this bit]/..

Error 2: System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource.

Solution is to correct res://../[ThisBit]

Possibly you require FolderName.ModelName.

 

Other notes

If do not have Initial Catalog then will attach it to program and detach itself from SQL. Agh ! May also need User Instance = False for this.

Connection string in App.config.

Name and Model name need to match.

In edmx change Entity Set Names to have an ‘s’ on the end for each entity

Good luck !

 

Error handling Stack Frame

Technorati Tags:
 

Dim stackFrame As New Diagnostics.StackFrame(1)
Dim sProcedure As String = stackFrame.GetMethod.Name
Dim sModuleName As String = stackFrame.GetMethod.DeclaringType.FullName

Set ToolStripTextBox Focus when Opening the form

me.ActiveControl=me.ToolStripTextBox.Control
You also need to set the ToolStrip’s (not the ToolStripTextBox’s – it doesn’t have the property) TabStop property to True.
Also if you set this active control on form load, then if you hide the form you may change the focus when it becomes visible again.
Could use following

PrivateSub frm_VisibleChanged(sender AsObject, e As System.EventArgs) HandlesMe.VisibleChanged

If Me.Visible Then
           ‘ToolStrip1.TabStop = True
            ActiveControl = InputProductToolStripTextBox.Control
   End If

EndSub

Lambda Enumerable..::.First<(Of )>) Generic Method (IEnumerable<(Of )>), Func<(Of )>))

 
 
ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/fxref_system.core/html/d232a6bf-5e64-d5b8-83f5-a0cf110f4107.htm
 

Public Function IsServiceRuning(ByVal scName As String) As Boolean

Dim scServices() As ServiceController
scServices = ServiceController.GetServices
Dim sc As ServiceController = scServices.First(Function(s) s.ServiceName = scName)
If sc.Status = ServiceControllerStatus.Running Then
Return True
End If

End Function

Debug Visualizer DataTables and DataSets

 
 
Hover over variable containing dataset or datatable.
Then look for drop down with magnifying glass.
Or go to Quick watch then look for magnifying glass
 
 
 

How to Count No. of Occurences of a Character in a String

 
 
LEN(ColumnToCheck) – LEN(REPLACE(ColumnToCheck,"N",""))
 
If it is more complex then see
 
 

GetOleDbSchemaTable Table Column Schema from JET MS Access

Public Sub GetDatabaseTableColumns()
Try
Dim table As DataTable
Using cn As New OleDb.OleDbConnection(My.Settings.conStrOneWay)
cn.Open()
Dim restrictionValues As String() = New String() {Nothing, Nothing, "Quotes", Nothing}
table = cn.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Columns, restrictionValues)
cn.Close()
End Using

Call DisplayData(table)

Catch ex As Exception
Throw ex
End Try
End Sub

Private Sub DisplayData(ByVal table As DataTable)
For i = 0 To table.Rows.Count - 1
Dim msg As String = table.Rows(i)!COLUMN_NAME.ToString & vbTab & table.Rows(i)!DATA_TYPE.ToString
Console.WriteLine(msg)
Debug.Print(msg)
Next i
End Sub

 

 

Code Generation using System.CodeDom

 
 
Create a code generation project.
For instance to create a class automatically from a database table. Successfully done this in VB.Net Project "CodeGeneration"
 
Now use to quickly create classes for RAD – Rapid Application Development
 
 
 
Found adding a blank line difficult. Answer is here
 

Dim blankLine As New CodeSnippetTypeMember("")
targetClass.Members.Add(blankLine)
 

When creating the Property Set Statements I have found that the Set does not include the (ByRef value as string) part.
However when using the class for the first time, just press return after the Class name and all of these are inserted automatically.

Steve

 
 

New Laptop / PC Specification Ideas

 
Notes from Dave Williams
 
7200 rpm disk or more
Bus speed 800 Mhz ?
RAM high as possible
Blue Ray ?