Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2006, 03:05 PM
Authorized User
 
Join Date: Jan 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default With Me .Show() I get error "end of statement exp

With Me .Show() I get error "end of statement expected"
When I get to the following code in the sample below: with me .show()
I get the error: end of statement expected


First, using Visual Studio Tools for Office, create a Microsoft Visual Basic Word Document project.
Name the project TaskPaneExample2. In your new project, do the following:

Set a reference to System.Drawing.dll.
Add a Windows Form to the project, and name the file TaskPane2.vb.
Drop a text box (leave it named TextBox1) and two buttons (named GetValueButton and
SetValueButton) onto the TaskPane2 form.
Add the following code above Public Class TaskPane2:

Imports Word = Microsoft.Office.Interop.Word
Imports System.Windows.Forms

Add the following code to the TaskPane2 - (Declarations) section:

Private wordDocument As TaskPaneExample2.OfficeCodeBehind
Dim screenHeight As Integer
Dim screenWidth As Integer
Dim heightPoints As Single
Dim widthPoints As Single
Dim dpi As Single
Dim document As Word.Document

Change the TaskPane2.New method so that it looks like this:

Public Sub New(ByVal wordDoc As TaskPaneExample2.OfficeCodeBehind)

    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call
    Me.wordDocument = wordDoc

    Dim screen As Screen = screen.PrimaryScreen

    screenHeight = screen.WorkingArea.Height
    screenWidth = screen.WorkingArea.Width

    ' Show the TaskPane2 form and initially size it to take up
    ' half the screen.
    With Me .Show()
        .Height = screenHeight
        .Width = screenWidth / 2
        .Top = 0
        .Left = screenWidth / 2
    End With

    Dim graphics As System.Drawing.Graphics = Me.CreateGraphics

    dpi = graphics.DpiX
    heightPoints = screenHeight / dpi * 72
    widthPoints = (screenWidth / 2) / dpi * 72

End Sub



 
Old March 20th, 2006, 09:12 PM
Authorized User
 
Join Date: Feb 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"With" applies to objects - you had applied it to the method call.
Use this instead:
    With Me
        .Show()
        .Height = screenHeight
        .Width = screenWidth / 2
        .Top = 0
        .Left = screenWidth / 2
    End With






Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Expected end of statement crabjoe Classic ASP Basics 3 December 4th, 2007 12:52 AM
Oracle Back End - MS Access Front End - Multi User ckaliveas Oracle 1 February 1st, 2007 06:00 AM
Show result during SQL statement rtr1900 ASP.NET 2.0 Basics 0 December 7th, 2006 06:51 AM
expected end of statement Adam H-W Classic ASP Databases 3 January 4th, 2005 05:37 AM
expected end of statement....help.... chaoz83 Classic ASP Databases 3 September 23rd, 2003 01:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.