473,837 Members | 1,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with error: Object reference...

Hello,

when I try to print something, either DataGrid or from Crystal Report viever
the folowing error message appears and cancels printing:

Object reference not set to an instance of an object :((((

Anyone pls help me to solve this problem!!!

thanks in advance,
Adriano
Nov 21 '05 #1
3 2443
Without code this is impossible. However, it is telling you that an
identifier of a specific object type is having a method called, but the
identifier is not pointing to an object. In other words it has had its type
declared but either the code failed to instantiate or is missing. Try
stepping thru in debug

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Adriano" <ad*****@tadaz. com> wrote in message
news:up******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing:

Object reference not set to an instance of an object :((((

Anyone pls help me to solve this problem!!!

thanks in advance,
Adriano

Nov 21 '05 #2
Hello Terry, here is the code:
----
Imports System.Data

Imports System.Data.Sql Client

Imports CrystalDecision s.CrystalReport s.Engine

Public Class ved_zpForm

Inherits System.Windows. Forms.Form

Protected Const SQL_CONNECTION_ STRING As String = _

"Server=WEBSERV ER;" & _

"DataBase=tadaz ;" & _

"Integrated Security=SSPI;C onnect Timeout=5"

Private ConnectionStrin g As String = SQL_CONNECTION_ STRING

Private HasConnected As Boolean = False

Private ServerName As String = "WEBSERVER"

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

'crvVedZP.Displ ayToolbar = True

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents crvVedZP As
CrystalDecision s.Windows.Forms .CrystalReportV iewer

Friend WithEvents Label1 As System.Windows. Forms.Label

Friend WithEvents cbData As System.Windows. Forms.ComboBox

Friend WithEvents btnLoad As System.Windows. Forms.Button

Friend WithEvents cbCex As System.Windows. Forms.ComboBox

Friend WithEvents Label2 As System.Windows. Forms.Label

Friend WithEvents Label3 As System.Windows. Forms.Label

Friend WithEvents SqlDataAdapter1 As System.Data.Sql Client.SqlDataA dapter

Friend WithEvents SqlConnection1 As System.Data.Sql Client.SqlConne ction

Friend WithEvents Ds_existing_tab les1 As TadazVB.ds_exis ting_tables

Friend WithEvents SqlDataAdapter2 As System.Data.Sql Client.SqlDataA dapter

Friend WithEvents Ds_cex1 As TadazVB.ds_cex

Friend WithEvents Label4 As System.Windows. Forms.Label

Friend WithEvents Label5 As System.Windows. Forms.Label

Friend WithEvents txtBoxNumVed As System.Windows. Forms.TextBox

Friend WithEvents SqlSelectComman d2 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlInsertComman d1 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlUpdateComman d1 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlDeleteComman d1 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlSelectComman d1 As System.Data.Sql Client.SqlComma nd

<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()

Me.crvVedZP = New CrystalDecision s.Windows.Forms .CrystalReportV iewer()

Me.Label1 = New System.Windows. Forms.Label()

Me.cbData = New System.Windows. Forms.ComboBox( )

Me.Ds_existing_ tables1 = New TadazVB.ds_exis ting_tables()

Me.btnLoad = New System.Windows. Forms.Button()

Me.cbCex = New System.Windows. Forms.ComboBox( )

Me.Ds_cex1 = New TadazVB.ds_cex( )

Me.Label2 = New System.Windows. Forms.Label()

Me.Label3 = New System.Windows. Forms.Label()

Me.SqlDataAdapt er1 = New System.Data.Sql Client.SqlDataA dapter()

Me.SqlSelectCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.SqlConnectio n1 = New System.Data.Sql Client.SqlConne ction()

Me.SqlDataAdapt er2 = New System.Data.Sql Client.SqlDataA dapter()

Me.SqlDeleteCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.SqlInsertCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.SqlSelectCom mand2 = New System.Data.Sql Client.SqlComma nd()

Me.SqlUpdateCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.Label4 = New System.Windows. Forms.Label()

Me.Label5 = New System.Windows. Forms.Label()

Me.txtBoxNumVed = New System.Windows. Forms.TextBox()

CType(Me.Ds_exi sting_tables1,
System.Componen tModel.ISupport Initialize).Beg inInit()

CType(Me.Ds_cex 1, System.Componen tModel.ISupport Initialize).Beg inInit()

Me.SuspendLayou t()

'

'crvVedZP

'

Me.crvVedZP.Act iveViewIndex = -1

Me.crvVedZP.Anc hor = (((System.Windo ws.Forms.Anchor Styles.Top Or
System.Windows. Forms.AnchorSty les.Bottom) _

Or System.Windows. Forms.AnchorSty les.Left) _

Or System.Windows. Forms.AnchorSty les.Right)

Me.crvVedZP.Dis playGroupTree = False

Me.crvVedZP.Loc ation = New System.Drawing. Point(16, 64)

Me.crvVedZP.Nam e = "crvVedZP"

Me.crvVedZP.Rep ortSource = Nothing

Me.crvVedZP.Sho wGroupTreeButto n = False

Me.crvVedZP.Sho wRefreshButton = False

Me.crvVedZP.Siz e = New System.Drawing. Size(680, 200)

Me.crvVedZP.Tab Index = 0

'

'Label1

'

Me.Label1.Locat ion = New System.Drawing. Point(32, 40)

Me.Label1.Name = "Label1"

Me.Label1.Size = New System.Drawing. Size(64, 16)

Me.Label1.TabIn dex = 2

Me.Label1.Text = ", "

'

'cbData

'

Me.cbData.DataS ource = Me.Ds_existing_ tables1

Me.cbData.Displ ayMember = "sysobjects.dat a"

Me.cbData.Locat ion = New System.Drawing. Point(96, 40)

Me.cbData.Name = "cbData"

Me.cbData.Size = New System.Drawing. Size(80, 21)

Me.cbData.TabIn dex = 5

'

'Ds_existing_ta bles1

'

Me.Ds_existing_ tables1.DataSet Name = "ds_existing_ta bles"

Me.Ds_existing_ tables1.Locale = New
System.Globaliz ation.CultureIn fo("ru-RU")

Me.Ds_existing_ tables1.Namespa ce =
"http://www.tempuri.org/ds_existing_tab les.xsd"

'

'btnLoad

'

Me.btnLoad.Loca tion = New System.Drawing. Point(616, 16)

Me.btnLoad.Name = "btnLoad"

Me.btnLoad.TabI ndex = 6

Me.btnLoad.Text = ""

'

'cbCex

'

Me.cbCex.DataSo urce = Me.Ds_cex1

Me.cbCex.Displa yMember = "spr_sp.sp"

Me.cbCex.Locati on = New System.Drawing. Point(96, 16)

Me.cbCex.Name = "cbCex"

Me.cbCex.Size = New System.Drawing. Size(56, 21)

Me.cbCex.TabInd ex = 7

'

'Ds_cex1

'

Me.Ds_cex1.Data SetName = "ds_cex"

Me.Ds_cex1.Loca le = New System.Globaliz ation.CultureIn fo("ru-RU")

Me.Ds_cex1.Name space = "http://www.tempuri.org/ds_cex.xsd"

'

'Label2

'

Me.Label2.Locat ion = New System.Drawing. Point(32, 16)

Me.Label2.Name = "Label2"

Me.Label2.Size = New System.Drawing. Size(32, 16)

Me.Label2.TabIn dex = 8

Me.Label2.Text = ""

'

'Label3

'

Me.Label3.DataB indings.Add(New System.Windows. Forms.Binding(" Text",
Me.Ds_cex1, "spr_sp.naim1") )

Me.Label3.Locat ion = New System.Drawing. Point(176, 16)

Me.Label3.Name = "Label3"

Me.Label3.Size = New System.Drawing. Size(360, 16)

Me.Label3.TabIn dex = 9

'

'SqlDataAdapter 1

'

Me.SqlDataAdapt er1.SelectComma nd = Me.SqlSelectCom mand1

Me.SqlDataAdapt er1.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "sysobjects ", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("data", "data"), New
System.Data.Com mon.DataColumnM apping("name", "name"), New
System.Data.Com mon.DataColumnM apping("month", "month"), New
System.Data.Com mon.DataColumnM apping("YEAR", "YEAR"), New
System.Data.Com mon.DataColumnM apping("id", "id")})})

'

'SqlSelectComma nd1

'

Me.SqlSelectCom mand1.CommandTe xt = "SELECT SUBSTRING(sysob jects.name, 8, 2)
+ RIGHT (sysobjects.nam e, 4) AS data, sys" & _

"objects.na me, spr_months.mont h, RIGHT (sysobjects.nam e, 4) AS YEAR,
spr_months.i" & _

"d FROM sysobjects INNER JOIN spr_months ON spr_months.num =
SUBSTRING(sysob jects" & _

".name, 8, 2) WHERE (sysobjects.xty pe = 'U') AND (sysobjects.nam e LIKE
'ozt_vo_%'" & _

") ORDER BY data"

Me.SqlSelectCom mand1.Connectio n = Me.SqlConnectio n1

'

'SqlConnection1

'

Me.SqlConnectio n1.ConnectionSt ring = "data source=WEBSERVE R;initial
catalog=tadaz;p assword=a;persi st security info=True" & _

";user id=sqluser;work station id=WEBSERVER;pa cket size=4096"

'

'SqlDataAdapter 2

'

Me.SqlDataAdapt er2.DeleteComma nd = Me.SqlDeleteCom mand1

Me.SqlDataAdapt er2.InsertComma nd = Me.SqlInsertCom mand1

Me.SqlDataAdapt er2.SelectComma nd = Me.SqlSelectCom mand2

Me.SqlDataAdapt er2.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "spr_sp", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("naim1", "naim1"), New
System.Data.Com mon.DataColumnM apping("sp", "sp")})})

Me.SqlDataAdapt er2.UpdateComma nd = Me.SqlUpdateCom mand1

'

'SqlDeleteComma nd1

'

Me.SqlDeleteCom mand1.CommandTe xt = "DELETE FROM spr_sp WHERE (sid =
@Original_sid) AND (naim1 = @Original_naim1 OR @O" & _

"riginal_na im1 IS NULL AND naim1 IS NULL) AND (sp = @Original_sp OR
@Original_sp " & _

"IS NULL AND sp IS NULL)"

Me.SqlDeleteCom mand1.Connectio n = Me.SqlConnectio n1

Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sid",
System.Data.Sql DbType.Int, 4, System.Data.Par ameterDirection .Input, False,
CType(0, Byte), CType(0, Byte), "sid", System.Data.Dat aRowVersion.Ori ginal,
Nothing))

Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _naim1",
System.Data.Sql DbType.VarChar, 255, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "naim1",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sp",
System.Data.Sql DbType.VarChar, 6, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "sp",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

'

'SqlInsertComma nd1

'

Me.SqlInsertCom mand1.CommandTe xt = "INSERT INTO spr_sp(naim1, sp) VALUES
(@naim1, @sp); SELECT naim1, sp, sid FROM sp" & _

"r_sp WHERE (sid = @@IDENTITY) ORDER BY sp"

Me.SqlInsertCom mand1.Connectio n = Me.SqlConnectio n1

Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@naim1", System.Data.Sql DbType.VarChar,
255, "naim1"))

Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@sp", System.Data.Sql DbType.VarChar, 6,
"sp"))

'

'SqlSelectComma nd2

'

Me.SqlSelectCom mand2.CommandTe xt = "SELECT naim1, sp, sid FROM spr_sp ORDER
BY sp"

Me.SqlSelectCom mand2.Connectio n = Me.SqlConnectio n1

'

'SqlUpdateComma nd1

'

Me.SqlUpdateCom mand1.CommandTe xt = "UPDATE spr_sp SET naim1 = @naim1, sp =
@sp WHERE (sid = @Original_sid) AND (naim1" & _

" = @Original_naim1 OR @Original_naim1 IS NULL AND naim1 IS NULL) AND (sp =
@Orig" & _

"inal_sp OR @Original_sp IS NULL AND sp IS NULL); SELECT naim1, sp, sid FROM
spr_" & _

"sp WHERE (sid = @sid) ORDER BY sp"

Me.SqlUpdateCom mand1.Connectio n = Me.SqlConnectio n1

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@naim1", System.Data.Sql DbType.VarChar,
255, "naim1"))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@sp", System.Data.Sql DbType.VarChar, 6,
"sp"))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sid",
System.Data.Sql DbType.Int, 4, System.Data.Par ameterDirection .Input, False,
CType(0, Byte), CType(0, Byte), "sid", System.Data.Dat aRowVersion.Ori ginal,
Nothing))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _naim1",
System.Data.Sql DbType.VarChar, 255, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "naim1",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sp",
System.Data.Sql DbType.VarChar, 6, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "sp",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@sid", System.Data.Sql DbType.Int, 4,
"sid"))

'

'Label4

'

Me.Label4.DataB indings.Add(New System.Windows. Forms.Binding(" Text",
Me.Ds_existing_ tables1, "sysobjects.mon th"))

Me.Label4.ForeC olor = System.Drawing. SystemColors.Co ntrol

Me.Label4.Locat ion = New System.Drawing. Point(392, 40)

Me.Label4.Name = "Label4"

Me.Label4.Size = New System.Drawing. Size(72, 24)

Me.Label4.TabIn dex = 10

'

'Label5

'

Me.Label5.Locat ion = New System.Drawing. Point(232, 40)

Me.Label5.Name = "Label5"

Me.Label5.Size = New System.Drawing. Size(80, 16)

Me.Label5.TabIn dex = 11

Me.Label5.Text = "? "

'

'txtBoxNumVed

'

Me.txtBoxNumVed .Location = New System.Drawing. Point(328, 40)

Me.txtBoxNumVed .Name = "txtBoxNumV ed"

Me.txtBoxNumVed .Size = New System.Drawing. Size(40, 20)

Me.txtBoxNumVed .TabIndex = 12

Me.txtBoxNumVed .Text = ""

'

'ved_zpForm

'

Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)

Me.ClientSize = New System.Drawing. Size(712, 273)

Me.Controls.Add Range(New System.Windows. Forms.Control() {Me.txtBoxNumVe d,
Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.cbCex, Me.btnLoad, Me.cbData,
Me.Label1, Me.crvVedZP})

Me.Name = "ved_zpForm "

Me.StartPositio n = System.Windows. Forms.FormStart Position.Center Screen

Me.Text = " "

CType(Me.Ds_exi sting_tables1,
System.Componen tModel.ISupport Initialize).End Init()

CType(Me.Ds_cex 1, System.Componen tModel.ISupport Initialize).End Init()

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub btnLoad_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnLoad.Click

Dim cnSQL As SqlConnection

Dim cmSQL As SqlCommand

Dim drSQL As SqlDataReader

Dim IsConnecting As Boolean = True

While IsConnecting

Try

' Define connection string.

' You may need to change this for your environment.

cnSQL = New SqlConnection(C onnectionString )

cnSQL.Open()

' Instantiate Command Object to execute SQL Statements

cmSQL = New SqlCommand()

' Attach the command to the connection

cmSQL.Connectio n = cnSQL

' Set the command type to Text

cmSQL.CommandTy pe = CommandType.Tex t

' START: Commands are for this How-To only.

' Drop GetSelectedCex Store Procedure if it exists.

cmSQL.CommandTe xt = "IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id(N'[dbo].[GetDataForVedZP]') and OBJECTPROPERTY( id, N'IsProcedure')
= 1) " & _

"DROP PROCEDURE [dbo].[GetDataForVedZP] "

' Execute the statement

cmSQL.ExecuteNo nQuery()

' Create Stored Procedure

'SELECT sp, VO.tn, l_name, f_name, VO.vo, VO.so

'FROM ozt_vo VO INNER JOIN

' ok_main OK ON OK.tn = VO.tn

'WHERE LEFT(VO.sp, 2) = '01'

'ORDER BY VO.sp

Dim text As String = cbData.Text

cmSQL.CommandTe xt = "CREATE PROCEDURE dbo.GetDataForV edZP " & _

"AS " & _

"SELECT VO.sp, VO.tn, OK.l_name, OK.f_name, VO.vo, VO.so " & _

"FROM ozt_vo_" + text + " VO INNER JOIN " & _

"ok_main OK ON VO.tn = OK.tn " & _

"WHERE VO.sp = '" + cbCex.Text + "' " & _

"ORDER BY VO.sp " & _

"Return"

' Execute the statement

cmSQL.ExecuteNo nQuery()

' END: Commands for this How-To only.

IsConnecting = False

HasConnected = True

' Close Connection.

'drSQL.Close()

cnSQL.Close()

' Clean up.

cnSQL.Dispose()

cmSQL.Dispose()

Catch Err As Exception

' Report Non SQL Error to the user.

MsgBox(Err.ToSt ring(), MsgBoxStyle.Cri tical, "General Error")

End Try

End While

' In this event the Customer Orders Report is loaded

' and displayed in the crystal reports viewer.

' This report calls for a parameter which is pulled

' from the customer name combo box (cbCustomers).

' Objects used to set the parameters in the report

Dim pvCollection As New CrystalDecision s.Shared.Parame terValues()

Dim pdvYear As New CrystalDecision s.Shared.Parame terDiscreteValu e()

'Define month parameter

Dim pdvMonth As New CrystalDecision s.Shared.Parame terDiscreteValu e()

'Define numved

Dim pdvNumVed As New CrystalDecision s.Shared.Parame terDiscreteValu e()

Dim pdvCexNum As New CrystalDecision s.Shared.Parame terDiscreteValu e()

Dim pdvCexName As New CrystalDecision s.Shared.Parame terDiscreteValu e()

' Objects used to set the proper database connection information

Dim tbCurrent As CrystalDecision s.CrystalReport s.Engine.Table

Dim tliCurrent As CrystalDecision s.Shared.TableL ogOnInfo

' Create a report document instance to hold the report

Dim rptVedZP As New ReportDocument( )

Try

' Load the report

rptVedZP.Load(" ..\Reports\ved_ zp.rpt")

' Set the connection information for all the tables used in the report

' Leave UserID and Password blank for trusted connection

For Each tbCurrent In rptVedZP.Databa se.Tables

tliCurrent = tbCurrent.LogOn Info

With tliCurrent.Conn ectionInfo

..ServerName = ServerName

..UserID = ""

..Password = ""

..DatabaseName = "tadaz"

End With

tbCurrent.Apply LogOnInfo(tliCu rrent)

Next tbCurrent

' Set the discreet value to the customers name.

pdvYear.Value = Mid(cbData.Text , 3, 4)

' Add it to the parameter collection.

pvCollection.Ad d(pdvYear)

' Apply the current parameter values.

rptVedZP.DataDe finition.Parame terFields("Year ").ApplyCurrent Values(pvCollec t
ion)

'

pvCollection.Cl ear()

pdvMonth.Value = Label4.Text

pvCollection.Ad d(pdvMonth)

rptVedZP.DataDe finition.Parame terFields("Mont h").ApplyCurren tValues(pvColle c
tion)

pvCollection.Cl ear()

'Number vedom parameter

pdvNumVed.Value = txtBoxNumVed.Te xt

pvCollection.Ad d(pdvNumVed)

rptVedZP.DataDe finition.Parame terFields("Num_ ved").ApplyCurr entValues(pvCol l
ection)

pvCollection.Cl ear()

pdvCexNum.Value = cbCex.Text

pvCollection.Ad d(pdvCexNum)

rptVedZP.DataDe finition.Parame terFields("Cex_ num").ApplyCurr entValues(pvCol l
ection)

pvCollection.Cl ear()

pdvCexName.Valu e = Label3.Text

pvCollection.Ad d(pdvCexName)

rptVedZP.DataDe finition.Parame terFields("Cex_ name").ApplyCur rentValues(pvCo l
lection)

' Hide group tree for this report

'crvVedZP.Displ ayGroupTree = False

' Set the report source for the crystal reports viewer to the

' report instance.

crvVedZP.Report Source = rptVedZP

' Zoom viewer to fit to the whole page so the user can see the report

crvVedZP.Zoom(1 )

Catch Exp As LoadSaveReportE xception

MsgBox("Incorre ct path for loading report.", _

MsgBoxStyle.Cri tical, "Load Report Error")

Catch Exp As Exception

MsgBox(Exp.Mess age, MsgBoxStyle.Cri tical, "General Error")

End Try

End Sub

Private Sub ved_zpForm_Load (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

SqlDataAdapter1 .Fill(Ds_existi ng_tables1)

SqlDataAdapter2 .Fill(Ds_cex1)

End Sub

End Class

----

Regards,
Adriano
"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message
news:#P******** ******@tk2msftn gp13.phx.gbl...
Without code this is impossible. However, it is telling you that an
identifier of a specific object type is having a method called, but the
identifier is not pointing to an object. In other words it has had its type declared but either the code failed to instantiate or is missing. Try
stepping thru in debug

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Adriano" <ad*****@tadaz. com> wrote in message
news:up******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

when I try to print something, either DataGrid or from Crystal Report

viever
the folowing error message appears and cancels printing:

Object reference not set to an instance of an object :((((

Anyone pls help me to solve this problem!!!

thanks in advance,
Adriano


Nov 21 '05 #3
Too much code. You need to Isolate in debug where you are having the
problem. In any case I notice you have a Crystal imports there, I'm not sure
if I have that

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Adriano" <ad*****@tadaz. com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Hello Terry, here is the code:
----
Imports System.Data

Imports System.Data.Sql Client

Imports CrystalDecision s.CrystalReport s.Engine

Public Class ved_zpForm

Inherits System.Windows. Forms.Form

Protected Const SQL_CONNECTION_ STRING As String = _

"Server=WEBSERV ER;" & _

"DataBase=tadaz ;" & _

"Integrated Security=SSPI;C onnect Timeout=5"

Private ConnectionStrin g As String = SQL_CONNECTION_ STRING

Private HasConnected As Boolean = False

Private ServerName As String = "WEBSERVER"

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

'crvVedZP.Displ ayToolbar = True

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Disp ose()

End If

End If

MyBase.Dispose( disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents crvVedZP As
CrystalDecision s.Windows.Forms .CrystalReportV iewer

Friend WithEvents Label1 As System.Windows. Forms.Label

Friend WithEvents cbData As System.Windows. Forms.ComboBox

Friend WithEvents btnLoad As System.Windows. Forms.Button

Friend WithEvents cbCex As System.Windows. Forms.ComboBox

Friend WithEvents Label2 As System.Windows. Forms.Label

Friend WithEvents Label3 As System.Windows. Forms.Label

Friend WithEvents SqlDataAdapter1 As System.Data.Sql Client.SqlDataA dapter

Friend WithEvents SqlConnection1 As System.Data.Sql Client.SqlConne ction

Friend WithEvents Ds_existing_tab les1 As TadazVB.ds_exis ting_tables

Friend WithEvents SqlDataAdapter2 As System.Data.Sql Client.SqlDataA dapter

Friend WithEvents Ds_cex1 As TadazVB.ds_cex

Friend WithEvents Label4 As System.Windows. Forms.Label

Friend WithEvents Label5 As System.Windows. Forms.Label

Friend WithEvents txtBoxNumVed As System.Windows. Forms.TextBox

Friend WithEvents SqlSelectComman d2 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlInsertComman d1 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlUpdateComman d1 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlDeleteComman d1 As System.Data.Sql Client.SqlComma nd

Friend WithEvents SqlSelectComman d1 As System.Data.Sql Client.SqlComma nd

<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
Me.crvVedZP = New CrystalDecision s.Windows.Forms .CrystalReportV iewer()

Me.Label1 = New System.Windows. Forms.Label()

Me.cbData = New System.Windows. Forms.ComboBox( )

Me.Ds_existing_ tables1 = New TadazVB.ds_exis ting_tables()

Me.btnLoad = New System.Windows. Forms.Button()

Me.cbCex = New System.Windows. Forms.ComboBox( )

Me.Ds_cex1 = New TadazVB.ds_cex( )

Me.Label2 = New System.Windows. Forms.Label()

Me.Label3 = New System.Windows. Forms.Label()

Me.SqlDataAdapt er1 = New System.Data.Sql Client.SqlDataA dapter()

Me.SqlSelectCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.SqlConnectio n1 = New System.Data.Sql Client.SqlConne ction()

Me.SqlDataAdapt er2 = New System.Data.Sql Client.SqlDataA dapter()

Me.SqlDeleteCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.SqlInsertCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.SqlSelectCom mand2 = New System.Data.Sql Client.SqlComma nd()

Me.SqlUpdateCom mand1 = New System.Data.Sql Client.SqlComma nd()

Me.Label4 = New System.Windows. Forms.Label()

Me.Label5 = New System.Windows. Forms.Label()

Me.txtBoxNumVed = New System.Windows. Forms.TextBox()

CType(Me.Ds_exi sting_tables1,
System.Componen tModel.ISupport Initialize).Beg inInit()

CType(Me.Ds_cex 1, System.Componen tModel.ISupport Initialize).Beg inInit()

Me.SuspendLayou t()

'

'crvVedZP

'

Me.crvVedZP.Act iveViewIndex = -1

Me.crvVedZP.Anc hor = (((System.Windo ws.Forms.Anchor Styles.Top Or
System.Windows. Forms.AnchorSty les.Bottom) _

Or System.Windows. Forms.AnchorSty les.Left) _

Or System.Windows. Forms.AnchorSty les.Right)

Me.crvVedZP.Dis playGroupTree = False

Me.crvVedZP.Loc ation = New System.Drawing. Point(16, 64)

Me.crvVedZP.Nam e = "crvVedZP"

Me.crvVedZP.Rep ortSource = Nothing

Me.crvVedZP.Sho wGroupTreeButto n = False

Me.crvVedZP.Sho wRefreshButton = False

Me.crvVedZP.Siz e = New System.Drawing. Size(680, 200)

Me.crvVedZP.Tab Index = 0

'

'Label1

'

Me.Label1.Locat ion = New System.Drawing. Point(32, 40)

Me.Label1.Name = "Label1"

Me.Label1.Size = New System.Drawing. Size(64, 16)

Me.Label1.TabIn dex = 2

Me.Label1.Text = ", "

'

'cbData

'

Me.cbData.DataS ource = Me.Ds_existing_ tables1

Me.cbData.Displ ayMember = "sysobjects.dat a"

Me.cbData.Locat ion = New System.Drawing. Point(96, 40)

Me.cbData.Name = "cbData"

Me.cbData.Size = New System.Drawing. Size(80, 21)

Me.cbData.TabIn dex = 5

'

'Ds_existing_ta bles1

'

Me.Ds_existing_ tables1.DataSet Name = "ds_existing_ta bles"

Me.Ds_existing_ tables1.Locale = New
System.Globaliz ation.CultureIn fo("ru-RU")

Me.Ds_existing_ tables1.Namespa ce =
"http://www.tempuri.org/ds_existing_tab les.xsd"

'

'btnLoad

'

Me.btnLoad.Loca tion = New System.Drawing. Point(616, 16)

Me.btnLoad.Name = "btnLoad"

Me.btnLoad.TabI ndex = 6

Me.btnLoad.Text = ""

'

'cbCex

'

Me.cbCex.DataSo urce = Me.Ds_cex1

Me.cbCex.Displa yMember = "spr_sp.sp"

Me.cbCex.Locati on = New System.Drawing. Point(96, 16)

Me.cbCex.Name = "cbCex"

Me.cbCex.Size = New System.Drawing. Size(56, 21)

Me.cbCex.TabInd ex = 7

'

'Ds_cex1

'

Me.Ds_cex1.Data SetName = "ds_cex"

Me.Ds_cex1.Loca le = New System.Globaliz ation.CultureIn fo("ru-RU")

Me.Ds_cex1.Name space = "http://www.tempuri.org/ds_cex.xsd"

'

'Label2

'

Me.Label2.Locat ion = New System.Drawing. Point(32, 16)

Me.Label2.Name = "Label2"

Me.Label2.Size = New System.Drawing. Size(32, 16)

Me.Label2.TabIn dex = 8

Me.Label2.Text = ""

'

'Label3

'

Me.Label3.DataB indings.Add(New System.Windows. Forms.Binding(" Text",
Me.Ds_cex1, "spr_sp.naim1") )

Me.Label3.Locat ion = New System.Drawing. Point(176, 16)

Me.Label3.Name = "Label3"

Me.Label3.Size = New System.Drawing. Size(360, 16)

Me.Label3.TabIn dex = 9

'

'SqlDataAdapter 1

'

Me.SqlDataAdapt er1.SelectComma nd = Me.SqlSelectCom mand1

Me.SqlDataAdapt er1.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "sysobjects ", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("data", "data"), New
System.Data.Com mon.DataColumnM apping("name", "name"), New
System.Data.Com mon.DataColumnM apping("month", "month"), New
System.Data.Com mon.DataColumnM apping("YEAR", "YEAR"), New
System.Data.Com mon.DataColumnM apping("id", "id")})})

'

'SqlSelectComma nd1

'

Me.SqlSelectCom mand1.CommandTe xt = "SELECT SUBSTRING(sysob jects.name, 8, 2) + RIGHT (sysobjects.nam e, 4) AS data, sys" & _

"objects.na me, spr_months.mont h, RIGHT (sysobjects.nam e, 4) AS YEAR,
spr_months.i" & _

"d FROM sysobjects INNER JOIN spr_months ON spr_months.num =
SUBSTRING(sysob jects" & _

".name, 8, 2) WHERE (sysobjects.xty pe = 'U') AND (sysobjects.nam e LIKE
'ozt_vo_%'" & _

") ORDER BY data"

Me.SqlSelectCom mand1.Connectio n = Me.SqlConnectio n1

'

'SqlConnection1

'

Me.SqlConnectio n1.ConnectionSt ring = "data source=WEBSERVE R;initial
catalog=tadaz;p assword=a;persi st security info=True" & _

";user id=sqluser;work station id=WEBSERVER;pa cket size=4096"

'

'SqlDataAdapter 2

'

Me.SqlDataAdapt er2.DeleteComma nd = Me.SqlDeleteCom mand1

Me.SqlDataAdapt er2.InsertComma nd = Me.SqlInsertCom mand1

Me.SqlDataAdapt er2.SelectComma nd = Me.SqlSelectCom mand2

Me.SqlDataAdapt er2.TableMappin gs.AddRange(New
System.Data.Com mon.DataTableMa pping() {New
System.Data.Com mon.DataTableMa pping("Table", "spr_sp", New
System.Data.Com mon.DataColumnM apping() {New
System.Data.Com mon.DataColumnM apping("naim1", "naim1"), New
System.Data.Com mon.DataColumnM apping("sp", "sp")})})

Me.SqlDataAdapt er2.UpdateComma nd = Me.SqlUpdateCom mand1

'

'SqlDeleteComma nd1

'

Me.SqlDeleteCom mand1.CommandTe xt = "DELETE FROM spr_sp WHERE (sid =
@Original_sid) AND (naim1 = @Original_naim1 OR @O" & _

"riginal_na im1 IS NULL AND naim1 IS NULL) AND (sp = @Original_sp OR
@Original_sp " & _

"IS NULL AND sp IS NULL)"

Me.SqlDeleteCom mand1.Connectio n = Me.SqlConnectio n1

Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sid",
System.Data.Sql DbType.Int, 4, System.Data.Par ameterDirection .Input, False,
CType(0, Byte), CType(0, Byte), "sid", System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _naim1",
System.Data.Sql DbType.VarChar, 255, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "naim1",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlDeleteCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sp",
System.Data.Sql DbType.VarChar, 6, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "sp",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

'

'SqlInsertComma nd1

'

Me.SqlInsertCom mand1.CommandTe xt = "INSERT INTO spr_sp(naim1, sp) VALUES
(@naim1, @sp); SELECT naim1, sp, sid FROM sp" & _

"r_sp WHERE (sid = @@IDENTITY) ORDER BY sp"

Me.SqlInsertCom mand1.Connectio n = Me.SqlConnectio n1

Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@naim1", System.Data.Sql DbType.VarChar, 255, "naim1"))

Me.SqlInsertCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@sp", System.Data.Sql DbType.VarChar, 6, "sp"))

'

'SqlSelectComma nd2

'

Me.SqlSelectCom mand2.CommandTe xt = "SELECT naim1, sp, sid FROM spr_sp ORDER BY sp"

Me.SqlSelectCom mand2.Connectio n = Me.SqlConnectio n1

'

'SqlUpdateComma nd1

'

Me.SqlUpdateCom mand1.CommandTe xt = "UPDATE spr_sp SET naim1 = @naim1, sp =
@sp WHERE (sid = @Original_sid) AND (naim1" & _

" = @Original_naim1 OR @Original_naim1 IS NULL AND naim1 IS NULL) AND (sp = @Orig" & _

"inal_sp OR @Original_sp IS NULL AND sp IS NULL); SELECT naim1, sp, sid FROM spr_" & _

"sp WHERE (sid = @sid) ORDER BY sp"

Me.SqlUpdateCom mand1.Connectio n = Me.SqlConnectio n1

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@naim1", System.Data.Sql DbType.VarChar, 255, "naim1"))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@sp", System.Data.Sql DbType.VarChar, 6, "sp"))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sid",
System.Data.Sql DbType.Int, 4, System.Data.Par ameterDirection .Input, False,
CType(0, Byte), CType(0, Byte), "sid", System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _naim1",
System.Data.Sql DbType.VarChar, 255, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "naim1",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@Original _sp",
System.Data.Sql DbType.VarChar, 6, System.Data.Par ameterDirection .Input,
False, CType(0, Byte), CType(0, Byte), "sp",
System.Data.Dat aRowVersion.Ori ginal, Nothing))

Me.SqlUpdateCom mand1.Parameter s.Add(New
System.Data.Sql Client.SqlParam eter("@sid", System.Data.Sql DbType.Int, 4,
"sid"))

'

'Label4

'

Me.Label4.DataB indings.Add(New System.Windows. Forms.Binding(" Text",
Me.Ds_existing_ tables1, "sysobjects.mon th"))

Me.Label4.ForeC olor = System.Drawing. SystemColors.Co ntrol

Me.Label4.Locat ion = New System.Drawing. Point(392, 40)

Me.Label4.Name = "Label4"

Me.Label4.Size = New System.Drawing. Size(72, 24)

Me.Label4.TabIn dex = 10

'

'Label5

'

Me.Label5.Locat ion = New System.Drawing. Point(232, 40)

Me.Label5.Name = "Label5"

Me.Label5.Size = New System.Drawing. Size(80, 16)

Me.Label5.TabIn dex = 11

Me.Label5.Text = "? "

'

'txtBoxNumVed

'

Me.txtBoxNumVed .Location = New System.Drawing. Point(328, 40)

Me.txtBoxNumVed .Name = "txtBoxNumV ed"

Me.txtBoxNumVed .Size = New System.Drawing. Size(40, 20)

Me.txtBoxNumVed .TabIndex = 12

Me.txtBoxNumVed .Text = ""

'

'ved_zpForm

'

Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)

Me.ClientSize = New System.Drawing. Size(712, 273)

Me.Controls.Add Range(New System.Windows. Forms.Control() {Me.txtBoxNumVe d,
Me.Label5, Me.Label4, Me.Label3, Me.Label2, Me.cbCex, Me.btnLoad, Me.cbData, Me.Label1, Me.crvVedZP})

Me.Name = "ved_zpForm "

Me.StartPositio n = System.Windows. Forms.FormStart Position.Center Screen

Me.Text = " "

CType(Me.Ds_exi sting_tables1,
System.Componen tModel.ISupport Initialize).End Init()

CType(Me.Ds_cex 1, System.Componen tModel.ISupport Initialize).End Init()

Me.ResumeLayout (False)

End Sub

#End Region

Private Sub btnLoad_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnLoad.Click

Dim cnSQL As SqlConnection

Dim cmSQL As SqlCommand

Dim drSQL As SqlDataReader

Dim IsConnecting As Boolean = True

While IsConnecting

Try

' Define connection string.

' You may need to change this for your environment.

cnSQL = New SqlConnection(C onnectionString )

cnSQL.Open()

' Instantiate Command Object to execute SQL Statements

cmSQL = New SqlCommand()

' Attach the command to the connection

cmSQL.Connectio n = cnSQL

' Set the command type to Text

cmSQL.CommandTy pe = CommandType.Tex t

' START: Commands are for this How-To only.

' Drop GetSelectedCex Store Procedure if it exists.

cmSQL.CommandTe xt = "IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id(N'[dbo].[GetDataForVedZP]') and OBJECTPROPERTY( id, N'IsProcedure') = 1) " & _

"DROP PROCEDURE [dbo].[GetDataForVedZP] "

' Execute the statement

cmSQL.ExecuteNo nQuery()

' Create Stored Procedure

'SELECT sp, VO.tn, l_name, f_name, VO.vo, VO.so

'FROM ozt_vo VO INNER JOIN

' ok_main OK ON OK.tn = VO.tn

'WHERE LEFT(VO.sp, 2) = '01'

'ORDER BY VO.sp

Dim text As String = cbData.Text

cmSQL.CommandTe xt = "CREATE PROCEDURE dbo.GetDataForV edZP " & _

"AS " & _

"SELECT VO.sp, VO.tn, OK.l_name, OK.f_name, VO.vo, VO.so " & _

"FROM ozt_vo_" + text + " VO INNER JOIN " & _

"ok_main OK ON VO.tn = OK.tn " & _

"WHERE VO.sp = '" + cbCex.Text + "' " & _

"ORDER BY VO.sp " & _

"Return"

' Execute the statement

cmSQL.ExecuteNo nQuery()

' END: Commands for this How-To only.

IsConnecting = False

HasConnected = True

' Close Connection.

'drSQL.Close()

cnSQL.Close()

' Clean up.

cnSQL.Dispose()

cmSQL.Dispose()

Catch Err As Exception

' Report Non SQL Error to the user.

MsgBox(Err.ToSt ring(), MsgBoxStyle.Cri tical, "General Error")

End Try

End While

' In this event the Customer Orders Report is loaded

' and displayed in the crystal reports viewer.

' This report calls for a parameter which is pulled

' from the customer name combo box (cbCustomers).

' Objects used to set the parameters in the report

Dim pvCollection As New CrystalDecision s.Shared.Parame terValues()

Dim pdvYear As New CrystalDecision s.Shared.Parame terDiscreteValu e()

'Define month parameter

Dim pdvMonth As New CrystalDecision s.Shared.Parame terDiscreteValu e()

'Define numved

Dim pdvNumVed As New CrystalDecision s.Shared.Parame terDiscreteValu e()

Dim pdvCexNum As New CrystalDecision s.Shared.Parame terDiscreteValu e()

Dim pdvCexName As New CrystalDecision s.Shared.Parame terDiscreteValu e()

' Objects used to set the proper database connection information

Dim tbCurrent As CrystalDecision s.CrystalReport s.Engine.Table

Dim tliCurrent As CrystalDecision s.Shared.TableL ogOnInfo

' Create a report document instance to hold the report

Dim rptVedZP As New ReportDocument( )

Try

' Load the report

rptVedZP.Load(" ..\Reports\ved_ zp.rpt")

' Set the connection information for all the tables used in the report

' Leave UserID and Password blank for trusted connection

For Each tbCurrent In rptVedZP.Databa se.Tables

tliCurrent = tbCurrent.LogOn Info

With tliCurrent.Conn ectionInfo

.ServerName = ServerName

.UserID = ""

.Password = ""

.DatabaseName = "tadaz"

End With

tbCurrent.Apply LogOnInfo(tliCu rrent)

Next tbCurrent

' Set the discreet value to the customers name.

pdvYear.Value = Mid(cbData.Text , 3, 4)

' Add it to the parameter collection.

pvCollection.Ad d(pdvYear)

' Apply the current parameter values.

rptVedZP.DataDe finition.Parame terFields("Year ").ApplyCurrent Values(pvCollec t ion)

'

pvCollection.Cl ear()

pdvMonth.Value = Label4.Text

pvCollection.Ad d(pdvMonth)

rptVedZP.DataDe finition.Parame terFields("Mont h").ApplyCurren tValues(pvColle c tion)

pvCollection.Cl ear()

'Number vedom parameter

pdvNumVed.Value = txtBoxNumVed.Te xt

pvCollection.Ad d(pdvNumVed)

rptVedZP.DataDe finition.Parame terFields("Num_ ved").ApplyCurr entValues(pvCol l ection)

pvCollection.Cl ear()

pdvCexNum.Value = cbCex.Text

pvCollection.Ad d(pdvCexNum)

rptVedZP.DataDe finition.Parame terFields("Cex_ num").ApplyCurr entValues(pvCol l ection)

pvCollection.Cl ear()

pdvCexName.Valu e = Label3.Text

pvCollection.Ad d(pdvCexName)

rptVedZP.DataDe finition.Parame terFields("Cex_ name").ApplyCur rentValues(pvCo l lection)

' Hide group tree for this report

'crvVedZP.Displ ayGroupTree = False

' Set the report source for the crystal reports viewer to the

' report instance.

crvVedZP.Report Source = rptVedZP

' Zoom viewer to fit to the whole page so the user can see the report

crvVedZP.Zoom(1 )

Catch Exp As LoadSaveReportE xception

MsgBox("Incorre ct path for loading report.", _

MsgBoxStyle.Cri tical, "Load Report Error")

Catch Exp As Exception

MsgBox(Exp.Mess age, MsgBoxStyle.Cri tical, "General Error")

End Try

End Sub

Private Sub ved_zpForm_Load (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

SqlDataAdapter1 .Fill(Ds_existi ng_tables1)

SqlDataAdapter2 .Fill(Ds_cex1)

End Sub

End Class

----

Regards,
Adriano
"One Handed Man ( OHM - Terry Burns )" <news.microsoft .com> wrote in message news:#P******** ******@tk2msftn gp13.phx.gbl...
Without code this is impossible. However, it is telling you that an
identifier of a specific object type is having a method called, but the
identifier is not pointing to an object. In other words it has had its

type
declared but either the code failed to instantiate or is missing. Try
stepping thru in debug

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don't know what you're doing

"Adriano" <ad*****@tadaz. com> wrote in message
news:up******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

when I try to print something, either DataGrid or from Crystal Report

viever
the folowing error message appears and cancels printing:

Object reference not set to an instance of an object :((((

Anyone pls help me to solve this problem!!!

thanks in advance,
Adriano



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2158
by: xuatla | last post by:
Hi, I encountered the following compile error of c++ and hope to get your help. test2.cpp: In member function `CTest CTest::operator+=(CTest&)': test2.cpp:79: error: no match for 'operator=' in '*this = CTest::operator+(CTest&)((+t2))' test2.cpp:49: error: candidates are: CTest CTest::operator=(CTest&) make: *** Error 1
23
3302
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application to create certain textboxes, labels, and combo boxes? Any ideas would be appreciated. Thanks
4
2688
by: Frawls | last post by:
Hi, I get the following error when trying to run a search on my aspx site, this error only occours if the product im searching for does not exist. Can anybody explain this please and help me with a solution, i know its probably simple but im new to the game...Cheers ----------------------------------------------------------------------- Object reference not set to an instance of an object.
0
1611
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520" AutoPostBackOnNodeMove="false" DragAndDropEnabled="true" NodeEditingEnabled="False" KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode" HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
8
1835
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for any help... Error: -----
6
5007
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a PDF. It works fine so far....
13
4343
by: Joner | last post by:
Hello, I'm having trouble with a little programme of mine where I connect to an access database. It seems to connect fine, and disconnect fine, but then after it won't reconnect, I get the error "operation is not allowed when object is open" so I take out the line of code: BookDetails.Connection1.Open and it comes up with the error "operation is not allowed when object
7
1574
by: Brett | last post by:
I'm not sure why I keep getting this error, "Object reference not set to an instance of an object". Private Function somefunction() as string Dim MyCurrentClass As New Class1 Try For i As Integer = 0 To LinkResults.Length - 1 With MyCurrentClass.SqlCmd_Insert_LinkVB .CommandType = System.Data.CommandType.StoredProcedure
12
5349
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded the custom employee class and have built it as a separate library (employee.dll). This employee.dll is being referenced by both the web service and the windows application. I face the following problem when I send this class to the webservice.
3
4418
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here really understand how this could be an issue. The assemblies that the system is complaining about are ones that we build here and we're not changing version numbers on anything. The errors come and go with no apparent rhyme or reason. We do not...
0
9837
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10870
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10267
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9392
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7804
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6998
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5668
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5845
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4038
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.