Code Snippet Editor


Author
Message
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
This may fall into the category of "Well, duh!" but just in case anybody is lower on the learning curve than I am :

There is an extremely cool code snippets editor on the tools menu of VS.  Basically is adds stuff to intellisense.

I created a new folder for Strataframe snippets.  Here is an example of a Custom Field Property snippet

( this is instead of cutting and pasting from the bo.designer generated code as in the beginner tutorial. Note that the string datatype is hardcoded so either make a $replacement$ for it or remember to change it if your custom field prop isn't string Wink

#Region " Custom Field Properties "

''' <summary>

''' $Custom Field Description$

''' </summary>

''' <remarks></remarks>

<Browsable(False), _

BusinessFieldDisplayInEditor(), _

Description("$Custom Field Description$"), _

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _

Public ReadOnly Property [$Property Name$]() As System.String

Get

Return $Property Value$

End Get

End Property

Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()

'-- Create and return a new array of FieldPropertyDescriptor

' objects that contains the ReflectionPropertyDescriptor

' for the $Property Name$ field.

Return New MicroFour.StrataFrame.Business.FieldPropertyDescriptor() { _

New MicroFour.StrataFrame.Business.ReflectionPropertyDescriptor( _

"$Property Name$", GetType($BOName$))}

End Function

#End Region

On the Imports tab you enter the stuff that must be imported for this to work

System.ComponentModel

Microfour.Strataframe.UI.Windows.Forms

For a shorcut I used cpr

Now if you are in the BO code, you just but the cursor under the Event Handlers region, type cpr, hit tab and everthing you see above gets typed in with the cursor on the first Replacement.  You fill it in, tab to the next one etc.

If the imports statements are not at the top of the declaration, the snippet editor puts them in !

I think this is cool and I'm pretty sure I've only scratched the surface of the possiblities here.

You may not see the Code Snippet Editor on the Tools menu ( for some reason mine didn't have it ) but if you Google you'll find it for download with easy instructions to install in.  Comes with a lot of predone VB stuff as well.

I've added

FillbyParam ( fbp )

Public Sub Fillby$Subname$(ByVal $param1$ As String)

'-- Establish locals

Dim loCommand As New SqlCommand()

'-- Build the query

loCommand.CommandText = "SELECT $Fieldlist$ FROM $tablename$ WHERE $param1$ like @$param1$+'%'"

'-- Add the parameter

loCommand.Parameters.Add("@$param1$", SqlDbType.NVarChar)

loCommand.Parameters("@$param1$").Value = $param1$

'-- Execute the command to fill the business object

Me.FillDataTable(loCommand)

End Sub Fillby$Subname$

MessageboxYesNo '

Dim dr As DialogResult = _

MessageBox.Show("$Message$","$Heading$", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)

If dr = Windows.Forms.DialogResult.Yes Then

End if

( sorry for the blank lines but I can't figure out how to turn off big line spaces after pasting code )

Would like to see what you guys who know a lot more about this stuff are doing with snippets  BigGrin

Charles

 

 

 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search