Using Words Spellcheck and grammer check with your windows Forms application

One of my customers wanted to add spell check functionality to their windows Form application.  knowing that everyone in their organization has Microsoft Office installed, I did not want to include word interop with the application. so I found a neat way of using words spellcheck. for more information you might want to check this article that was very helpful .

  Private Sub SpellAndGrammarCheck(ByVal YourTextbox As TextBox)

        Try

            Dim oWord As Object = Nothing

            Dim oDoc As Object = Nothing

            Dim oData As IDataObject = Nothing

            oWord = System.Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"))

 

           Dim  oDocuments as object = oWord.[GetType]().InvokeMember("Documents", _

                           BindingFlags.[Default] Or BindingFlags.GetProperty, _

                           Nothing, oWord, Nothing)

 

 

            oDoc = oDocuments.[GetType]().InvokeMember("Add", BindingFlags.[Default] _

                     Or BindingFlags.InvokeMethod, Nothing, oDocuments, Nothing)

            oWord.Visible = False

 

            oWord.WindowState = 0

            oWord.Top = -3000

            Clipboard.SetDataObject(YourTextbox.Text)

 

            With oDoc

                .Content.Paste()

                .Activate()

                .CheckGrammar()

                .Content.Copy()

                oData = Clipboard.GetDataObject

                If oData.GetDataPresent(DataFormats.Text) Then

                    YourTextbox.Text = CType(oData.GetData(DataFormats.Text), String)

                End If

                .Saved = True

                .Close()

            End With

            oWord.Quit()

            MsgBox("Spelling check complete!")

            'SPELLWORKING = True

        Catch COMEcep As COMException

            MsgBox("MS Word must be installed to perform spelling checks", , _

                   "Spell check is not available")

        Catch ex As Exception

            MsgBox("Error, Make sure you have MS word installed.", , ex.Message)

 

        End Try

End Sub

 

Using Words Spellcheck and grammer check with your windows Forms application

One of my customers wanted to add spell check functionality to their windows Form application.  knowing that everyone in their organization has Microsoft Office installed, I did not want to include word interop with the application. so I found a neat way of using words spellcheck. for more information you might want to check this article that was very helpful .

  Private Sub SpellAndGrammarCheck(ByVal YourTextbox As TextBox)

        Try

            Dim oWord As Object = Nothing

            Dim oDoc As Object = Nothing

            Dim oData As IDataObject = Nothing

            oWord = System.Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application"))

 

           Dim  oDocuments as object = oWord.[GetType]().InvokeMember("Documents", _

                           BindingFlags.[Default] Or BindingFlags.GetProperty, _

                           Nothing, oWord, Nothing)

 

 

            oDoc = oDocuments.[GetType]().InvokeMember("Add", BindingFlags.[Default] _

                     Or BindingFlags.InvokeMethod, Nothing, oDocuments, Nothing)

            oWord.Visible = False

 

            oWord.WindowState = 0

            oWord.Top = -3000

            Clipboard.SetDataObject(YourTextbox.Text)

 

            With oDoc

                .Content.Paste()

                .Activate()

                .CheckGrammar()

                .Content.Copy()

                oData = Clipboard.GetDataObject

                If oData.GetDataPresent(DataFormats.Text) Then

                    YourTextbox.Text = CType(oData.GetData(DataFormats.Text), String)

                End If

                .Saved = True

                .Close()

            End With

            oWord.Quit()

            MsgBox("Spelling check complete!")

            'SPELLWORKING = True

        Catch COMEcep As COMException

            MsgBox("MS Word must be installed to perform spelling checks", , _

                   "Spell check is not available")

        Catch ex As Exception

            MsgBox("Error, Make sure you have MS word installed.", , ex.Message)

 

        End Try

End Sub

 

How to get the current user logged into Sharepoint

the following snippet get the current user lgged into Sharepoint and displays his/her Name, Login name, Email and all the groups he/she belongs to.

try {SPWeb web = SPControl.GetContextWeb(Context);SPUser sUser = web.CurrentUser; string str = "Name:" + sUser.Name + "<BR>"; "Login Name :" + sUser.LoginName + "<BR>"; "Email:" + sUser.Email + "<BR>"; "Groups:" + sUser.Groups.Count + "<BR>"; foreach (SPGroup grp in sUser.Groups) { " * " + grp.Name + " total Members:" + grp.Users.Count + "<BR>"; catch (Exception ex) { "No Current User" ;

 

 

 

 

 

str +=

str +=

str +=

 

 

str +=

}

lblInfo.Text = str;

}

 

lblInfo.Text=

}

Using custom Assemblies with SQL Server Reporting Services.

In almost every Reporting Services class I teach, I get basically same questions. One of the most popular questions is how do I call a method in a custom assembly from my report.  Here are step By step, instructions to do this.

 

1.       Using Visual Studio Create a new Class Library(VB or C#) I am going to name my Project SSRSAssembly

2.       Rename your Class1.VB or Class1.CS to ComplexCalculations, presumably you would have your re-usable methods in this class

3.       For next step, please use your imagination, pretend the following function has a few lines of code with loops possible calls to other assemblies and does some complex calculations (instead of just returning the square value of the parameter being sent to it.

(a)    Add the following Method to your Class

VB

Public Function SquareMe(ByVal i As Integer) As Integer

        Return i ^ 2

End Function

C#

public int SquareMe(int i)

{

    return Math.Pow(i, 2);

}

    

4.       Build Your project .

5.       Open your Report project.

(1)    Access your report properties from the Reports menu option

(2)    Click on the reference tab and add a reference to your assembly by browsing to it.

(3)    Define the class name ( in my example I called my class  ComplexCalculations)

(4)    Provide an Instance name.

6.       In a textbox within your dataregion where you want to display the result of your call, enter:

=Code.MyInstance.SquareMe(Fields!SickLeaveHours.Value)

7.       Copy your Custom dll to Report Server bin folder (default location is C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin)

8.       Open rssvPolicy.config located in C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\ReportServer\bin.

9.       After the last <CodeGroup .. add

<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="SSRSAssembly" Description="reportHelperLib. ">

                <IMembershipCondition

                class="UrlMembershipCondition"

                version="1"

                Url="C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\SSRSAssembly.dll"

/>

              </CodeGroup>

10.   Note you might have to change the Name and the URL.

4th Annual South Florida Code Camp

The Code Camp will be held on Saturday 2/2/2008 and include breakfast, lunch, giveaways, valuable raffle items and of course lots of great content!

The sessions are now listed on the agenda page. A big thanks to all the speakers that have stepped forward and volunteered to come speak at their own expense. We have already scheduled 70 of 72 sessions. There will be something for everyone... from the person who is new to .net to advanced architecture and software process sessions. For the second year we will have an all Spanish track. Dedicated tracks include "Into to .NET", "Silverlight" and "Agile / CI". Sessions include Ajax, MVC, Visual Studio 2008, Powershell, Windows Workflow and .NET reflection.

Over 500 attendees have signed up, and we should easily bypass last years number, if yo uhave not signed up please do so http://www.clicktoattend.com/?id=122048


Find more information at http://codecamp08.fladotnet.com .

Visual Studio 2008 Install-Fest - Miramar - 12/11/2008 - Free Visual Studio! SOLD OUT!

There are only 50 copies available but we will have other activites so please stop by!

I've put up a list of the 1st 100 to register at: http://www.fladotnet.com/vs2k8.aspx.

There are only 50 copies but i'm sure that not all of the 1st 50 will show up on time with a computer to do the installation.


South Florida Code Camp Call for Speakers!


Speaker registration form at: http://codecamp08.fladotnet.com.

We have been receiving speaker proposals, should have enough rooms to accomodate anyone who wishes to speak and will get the sessions posted on the website soon.

The tracks (subject to change) are:

- Intro to .NET

- Web Development

- Windows / Smart Client

- SQL / Data / BI

- .NET New and Cool

- Agile / CI

- Architecture

- Frameworks

- Office Development

- Gaming

- SharePoint

- Spanish


To attend this outstanding free event, register at: http://www.clicktoattend.com/?id=122048
Example of using SSRS SOAP API

This example uses adventure works sample  database and reports, please refer to books on line for setup instructions.

1.       Open Visual Studio and create a console application (VB or C#)

2.       Replace the code in Module.vb or Module.cs with the appropriate code snippet

a.       C#

using System;

using SoapAPI.ReportService2005;

 

class Module1

{

 

         public void Main()

         {

                 ReportingService2005 rs = new ReportingService2005();

                 rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

 

                 rs.Url = "http://Localhost/reportserver/reportservice2005.asmx";

 

                 Property name = new Property();

                 name.Name = "Name";

 

                 Property description = new Property();

                 description.Name = "Description";

 

                 Property[] properties = new Property[2];

                 properties(0) = name;

                 properties(1) = description;

                 try {

                          Property[] returnProperties = rs.GetProperties("/AdventureWorks Sample Reports/Company Sales", properties);

                          Property p;

                          foreach ( p in returnProperties) {

                                   Console.WriteLine((p.Name + ": " + p.Value));

                          }

                 }