Value Types:
The .NET Framework includes a large number of built-in types that you can use directly or use to build your own custom types.
Value types directly contain their data, offering excellent performance. However, value types are limited to types that store very small pieces of data. In the .NET Framework, all value types are 16 bytes or shorter.
You can create user-defined types that store multiple values and methods. In object-oriented development environments, a large portion of your application logic will be stored in user-defined types.
Enumerations improve code readability by providing symbols for a set of values.
Reference Types:
Reference types contain the address of data rather than the actual data.
When you copy a value type, a second copy of the value is created. When you copy a reference type, only the pointer is copied. Therefore, if you copy a reference type and then modify the copy, both the copy and the original variables are changed.
The .NET Framework includes a large number of built-in reference types that you can use directly or use to build your own custom types.
Strings are immutable; use the StringBuilder class to create a string dynamically.
Use streams to read from and write to files, memory, and the network.
Use the Catch clause within Try blocks to filter exceptions by type. Close and dispose of nonmemory resources in the Finally clause of a Try block.
Wednesday, February 24, 2010
Friday, February 12, 2010
VS2008 Win Form - Calling Crystal report
Dim objRPT As New rptmatchstats
Dim objfrmRPTViewer As New frmreportviewer
'Note: The form has to be shown first, other wise report parameters are prompted
objfrmRPTViewer.CRPTViewer.Visible = False
objfrmRPTViewer.MdiParent = Me.MdiParent
objfrmRPTViewer.WindowState = FormWindowState.Maximized
objfrmRPTViewer.Show()
objRPT.PrintOptions.PaperSize = CrystalDecisions.[Shared].PaperSize.PaperLetter
oConn.applyLogonInfo(objRPT)
'Set Parameters
oConn.assignParameterValueToReport(objRPT, "@id", 10)
objfrmRPTViewer.CRPTViewer.ReportSource = objRPT
objfrmRPTViewer.CRPTViewer.ParameterFieldInfo.Clear()
objfrmRPTViewer.CRPTViewer.ParameterFieldInfo = objRPT.ParameterFields
objfrmRPTViewer.CRPTViewer.Visible = True
Sunday, December 13, 2009
VB.Net Draw String Center of Point location
Private Sub DrawStringCenterOfPoint(ByRef gr As Graphics, _
ByVal txt As String, ByVal txtfont As Font, _
ByVal txtcolor As Brush, ByVal location As PointF)
' Mark the center for debugging
Dim x as Single = location.X
Dim y as Single = location.Y
gr.DrawLine(New Pen(Color.Red, 2), x - 10, y, x + 10, y)
' Make a StringFormat object that centers
Dim sf As New StringFormat
sf.LineAlignment = StringAlignment.Center
sf.Alignment = StringAlignment.Center
' Draw the text.
Dim StringSize As New SizeF
StringSize = gr.MeasureString(txt, txtfont)
gr.DrawString(txt, txtfont, txtcolor, x, y, sf)
sf.Dispose()
End Sub
VB.Net Find Center of a Polygon
Private Function CenterOfPolygon(ByRef _pointf() As PointF) As PointF
CenterOfPolygon = New Point(0, 0)
Dim total_points As Integer = _pointf.Length
Dim x_total As Single = 0, y_total As Single = 0
For Each _point As PointF In _pointf
x_total = x_total + _point.X
y_total = y_total + _point.Y
Next
CenterOfPolygon.X = x_total / total_points
CenterOfPolygon.Y = y_total / total_points
End Function
Subscribe to:
Posts (Atom)

