473,738 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inheriting forms problem

Hello,
In my project I am inheriting several forms. However when I
inherit from a form and add additional subroutines and methods to my
inherited form I get all sorts of problems. e.g. I sometimes get

MyVarialble is not declared errors when the variable is quite clearly
declared, when I change it to public and then back again to private the error
goes away!!!
Also I get lots of member not found errors, these however don't stop me from
running the application.

Any ideas on why these problems are occuring and how to get rid of them.
Regards
Geri

Nov 21 '05 #1
3 2374
Could you post the code for your base class form and your inherited form?

"Geraldine Hobley" <Ge************ *@discussions.m icrosoft.com> wrote in
message news:9F******** *************** ***********@mic rosoft.com...
Hello,
In my project I am inheriting several forms. However when I
inherit from a form and add additional subroutines and methods to my
inherited form I get all sorts of problems. e.g. I sometimes get

MyVarialble is not declared errors when the variable is quite clearly
declared, when I change it to public and then back again to private the
error
goes away!!!
Also I get lots of member not found errors, these however don't stop me
from
running the application.

Any ideas on why these problems are occuring and how to get rid of them.
Regards
Geri

Nov 21 '05 #2
Hi Beth,
The code for the base form is as follows:
n.b some of the declarations have been left out to save space
Public Class ProjectItemForm
Inherits System.Windows. Forms.Form
Public Sub New()
End Sub
Protected WithEvents dgProjectItem As System.Windows. Forms.DataGrid
Public WithEvents tcProjectItem As
Crownwood.DotNe tMagic.Controls .ToolControl
Public WithEvents btnCJobs As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCQuotes As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCOrders As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCCalloffs As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCInvoices As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCProjectDet As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Protected cmnuGrid As Crownwood.DotNe tMagic.Menus.Po pupMenu
Private CurrItem As CurrentItem
Public WithEvents ImgJobs As System.Windows. Forms.ImageList
Public WithEvents gpProjectInfo As System.Windows. Forms.GroupBox
Friend WithEvents bwsSearch As
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Public WithEvents ProjectSiteAddr ess As System.Windows. Forms.TextBox
Friend WithEvents lblAddress As System.Windows. Forms.Label
Public WithEvents ProjectSiteName As System.Windows. Forms.TextBox
Friend WithEvents LblSiteName As System.Windows. Forms.Label
Friend WithEvents bwsView As
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Public WithEvents tlProjectItem As System.Windows. Forms.ToolTip
Public WithEvents OEProjectItem As
Crownwood.DotNe tMagic.Controls .OfficeExtender
Friend WithEvents LblMarginMoney As System.Windows. Forms.Label
Friend WithEvents LblMarginPercen t As System.Windows. Forms.Label
Public WithEvents ctbMargin As CurrencyTextBox .CurrencyTextBo x
Public WithEvents PtxtMargin As Windows.Forms.T extBox
Friend WithEvents MenuControl1 As Crownwood.Magic .Menus.MenuCont rol
Me.dgProjectIte m = New System.Windows. Forms.DataGrid
Me.tcProjectIte m = New Crownwood.DotNe tMagic.Controls .ToolControl
Me.btnCProjectD et = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCJobs = New Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCQuotes = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCOrders = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCCalloffs = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCInvoices = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.ImgJobs = New System.Windows. Forms.ImageList (Me.components)
Me.gpProjectInf o = New System.Windows. Forms.GroupBox
Me.PtxtMargin = New System.Windows. Forms.TextBox
Me.ctbMargin = New CurrencyTextBox .CurrencyTextBo x
Me.LblMarginMon ey = New System.Windows. Forms.Label
Me.LblMarginPer cent = New System.Windows. Forms.Label
Me.bwsSearch = New Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Me.ProjectSiteA ddress = New System.Windows. Forms.TextBox
Me.lblAddress = New System.Windows. Forms.Label
Me.ProjectSiteN ame = New System.Windows. Forms.TextBox
Me.LblSiteName = New System.Windows. Forms.Label
Me.bwsView = New Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Me.tlProjectIte m = New System.Windows. Forms.ToolTip(M e.components)
Me.OEProjectIte m = New
Crownwood.DotNe tMagic.Controls .OfficeExtender (Me.components)
Me.MenuControl1 = New Crownwood.Magic .Menus.MenuCont rol
CType(Me.dgProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.tcProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
'dgProjectItem

The code for the child form is as follows
Imports ProjectList.Pro jectNameSpace.G ridfunctions.Da taGrids
Imports DirectoryNode
Imports System.Data.Sql Client
Namespace ProjectNameSpac e
Public Class frmJobs
Inherits ProjectItem_For m.ProjectItemFo rm

#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

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 bwsSetDefault As
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Friend WithEvents cboJobsStatus As System.Windows. Forms.ComboBox
Friend WithEvents TCJob As Crownwood.DotNe tMagic.Controls .ToolControl
Friend WithEvents btnCCopyJob As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Friend WithEvents btnCQuoteNotes As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Friend WithEvents ToolControl1 As
Crownwood.DotNe tMagic.Controls .ToolControl
Friend WithEvents btnCNewJob As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Friend WithEvents LblJobStatus As System.Windows. Forms.Label
Friend WithEvents AxOleLayout1 As AxOLELAYOUTLib. AxOleLayout
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Dim resources As System.Resource s.ResourceManag er = New
System.Resource s.ResourceManag er(GetType(frmJ obs))
Me.bwsSetDefaul t = New
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Me.cboJobsStatu s = New System.Windows. Forms.ComboBox
Me.TCJob = New Crownwood.DotNe tMagic.Controls .ToolControl
Me.btnCCopyJob = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCQuoteNot es = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.ToolControl1 = New Crownwood.DotNe tMagic.Controls .ToolControl
Me.LblJobStatus = New System.Windows. Forms.Label
Me.AxOleLayout1 = New AxOLELAYOUTLib. AxOleLayout
Me.gpProjectInf o.SuspendLayout ()
CType(Me.dgProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.tcProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.TCJob,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.ToolCo ntrol1,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.AxOleL ayout1,
System.Componen tModel.ISupport Initialize).Beg inInit()
Me.SuspendLayou t()
'
'PtxtMargin
'
Me.PtxtMargin.N ame = "PtxtMargin "
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Pt xtMargin,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'ctbMargin
'
Me.ctbMargin.Na me = "ctbMargin"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.ct bMargin,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'gpProjectInfo
'
Me.gpProjectInf o.Name = "gpProjectI nfo"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.gp ProjectInfo,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'dgProjectItem
'
Me.dgProjectIte m.Anchor =
CType(((System. Windows.Forms.A nchorStyles.Top Or
System.Windows. Forms.AnchorSty les.Left) _
Or System.Windows. Forms.AnchorSty les.Right),
System.Windows. Forms.AnchorSty les)
Me.dgProjectIte m.Name = "dgProjectI tem"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.dg ProjectItem,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.dgProjectIte m.Size = New System.Drawing. Size(648, 184)
'
'tcProjectItem
'
Me.tcProjectIte m.Name = "tcProjectI tem"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.tc ProjectItem,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'ProjectSiteNam e
'
Me.ProjectSiteN ame.Name = "ProjectSiteNam e"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Pr ojectSiteName,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'ProjectSiteAdd ress
'
Me.ProjectSiteA ddress.Name = "ProjectSiteAdd ress"
'
'bwsSetDefault
'
Me.bwsSetDefaul t.BackColor =
System.Drawing. Color.FromArgb( CType(195, Byte), CType(218, Byte), CType(249,
Byte))
Me.bwsSetDefaul t.Location = New System.Drawing. Point(200, 128)
Me.bwsSetDefaul t.Name = "bwsSetDefa ult"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.bw sSetDefault,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.bwsSetDefaul t.Size = New System.Drawing. Size(60, 21)
Me.bwsSetDefaul t.TabIndex = 6
Me.bwsSetDefaul t.Text = "Set &Default"
Me.bwsSetDefaul t.TextEdge =
Crownwood.DotNe tMagic.Common.T extEdge.Left
'
'cboJobsStatus
'
Me.cboJobsStatu s.DropDownStyle =
System.Windows. Forms.ComboBoxS tyle.DropDownLi st
Me.cboJobsStatu s.Location = New System.Drawing. Point(88, 128)
Me.cboJobsStatu s.Name = "cboJobsSta tus"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.cb oJobsStatus,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.cboJobsStatu s.Size = New System.Drawing. Size(104, 21)
Me.cboJobsStatu s.TabIndex = 5
'
'TCJob
'
Me.TCJob.Dock = System.Windows. Forms.DockStyle .Bottom
Me.TCJob.Locati on = New System.Drawing. Point(0, 552)
Me.TCJob.Name = "TCJob"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.TC Job,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.TCJob.Size = New System.Drawing. Size(860, 4)
Me.TCJob.TabInd ex = 11
'
'btnCCopyJob
'
Me.btnCCopyJob. Image =
CType(resources .GetObject("btn CCopyJob.Image" ), System.Drawing. Image)
Me.btnCCopyJob. Tag = Nothing
Me.btnCCopyJob. Text = "Copy Job"
'
'btnCQuoteNotes
'
Me.btnCQuoteNot es.Image =
CType(resources .GetObject("btn CQuoteNotes.Ima ge"), System.Drawing. Image)
Me.btnCQuoteNot es.Tag = Nothing
Me.btnCQuoteNot es.Text = "Quote Notes"
'
'ToolControl1
'
Me.ToolControl1 .Dock = System.Windows. Forms.DockStyle .Bottom
Me.ToolControl1 .Location = New System.Drawing. Point(0, 556)
Me.ToolControl1 .Name = "ToolContro l1"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.To olControl1,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.ToolControl1 .Size = New System.Drawing. Size(860, 4)
Me.ToolControl1 .TabIndex = 12
'
'LblJobStatus
'
Me.LblJobStatus .BackColor =
System.Drawing. Color.FromArgb( CType(195, Byte), CType(218, Byte), CType(249,
Byte))
Me.LblJobStatus .Location = New System.Drawing. Point(16, 128)
Me.LblJobStatus .Name = "LblJobStat us"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Lb lJobStatus,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.LblJobStatus .Size = New System.Drawing. Size(64, 16)
Me.LblJobStatus .TabIndex = 13
Me.LblJobStatus .Text = "Job Status:"
Me.LblJobStatus .TextAlign =
System.Drawing. ContentAlignmen t.BottomLeft
'
'AxOleLayout1
'
Me.AxOleLayout1 .Enabled = True
Me.AxOleLayout1 .Location = New System.Drawing. Point(32, 368)
Me.AxOleLayout1 .Name = "AxOleLayou t1"
Me.AxOleLayout1 .OcxState =
CType(resources .GetObject("AxO leLayout1.OcxSt ate"),
System.Windows. Forms.AxHost.St ate)
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Ax OleLayout1,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.AxOleLayout1 .Size = New System.Drawing. Size(264, 184)
Me.AxOleLayout1 .TabIndex = 14
'
'frmJobs
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(798, 529)
Me.Controls.Add (Me.AxOleLayout 1)
Me.Controls.Add (Me.LblJobStatu s)
Me.Controls.Add (Me.TCJob)
Me.Controls.Add (Me.bwsSetDefau lt)
Me.Controls.Add (Me.cboJobsStat us)
Me.Controls.Add (Me.ToolControl 1)
Me.Location = New System.Drawing. Point(0, 0)
Me.Name = "frmJobs"
Me.OEProjectIte m.SetOffice2003 BackColor(Me,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Base)
Me.Controls.Set ChildIndex(Me.T oolControl1, 0)
Me.Controls.Set ChildIndex(Me.d gProjectItem, 0)
Me.Controls.Set ChildIndex(Me.t cProjectItem, 0)
Me.Controls.Set ChildIndex(Me.g pProjectInfo, 0)
Me.Controls.Set ChildIndex(Me.c boJobsStatus, 0)
Me.Controls.Set ChildIndex(Me.b wsSetDefault, 0)
Me.Controls.Set ChildIndex(Me.T CJob, 0)
Me.Controls.Set ChildIndex(Me.L blJobStatus, 0)
Me.Controls.Set ChildIndex(Me.A xOleLayout1, 0)
Me.gpProjectInf o.ResumeLayout( False)
CType(Me.dgProj ectItem,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.tcProj ectItem,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.TCJob,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.ToolCo ntrol1,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.AxOleL ayout1,
System.Componen tModel.ISupport Initialize).End Init()
Me.ResumeLayout (False)

End Sub

#End Region

Private MyCombofunction s As New ComboFunctions
Private MyDataAccess As New DataAccess.Data Access
Private blnGridFormatte d As Boolean
Private MyGridfunctions As New Gridfunctions
Private MyDataset As New DataSet
Private dsJobs As New DataSet
Private MyJobsNode As DirectoryNode.J obSNode
Private MySqlDataAdapte r As SqlDataAdapter
Private IntDefaultValue As Integer
Friend Const CIntSelectAllJo bs As Integer = 3
Friend IntJobStatus As Integer
Friend MyProjectInfoTa ble As DataTable
Private blnContextMenu As Boolean = False

Private Sub frmJobs_Load(By Val sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim blnGridformatte d As Boolean
Me.tcProjectIte m.Commands.Remo ve(Me.btnCJobs)
Call SetupCombos()
MyGridFunctions .MydataGrid = dgProjectItem
blnGridformatte d = MyGridFunctions .FormatDataGrid (Jobs, "Jobs",
MyDataset)
GblProjectGrid = Me.dgProjectIte m
End Sub

Public Sub LoadData(ByVal MyNode As JobSNode)
MyDataset = MyNode.DataSet
MyJobsNode = MyNode
Call LoadJobs(MyNode .ProjectKey,
CType(cboJobsSt atus.SelectedVa lue, Integer))
Dim MyParentNode As ProjectNode
MyParentNode = CType(MyNode.Pa rent, ProjectNode)
MyProjectInfoTa ble = MyParentNode.Da taSet.Tables("P rojectInfo")
If MyDataset.Table s("Jobs").Rows. Count > 0 Then
Call SetLayout()
End If
Call BindProjectInfo (MyProjectInfoT able)
Call BindNonTextFiel ds(MyProjectInf oTable)
End Sub

Private Sub BindNonTextFiel ds(ByRef MyDatatable As DataTable)
Call BindCurrencyFie ld("Text", MyDatatable, "MarginMone y",
Me.ctbMargin)
End Sub

Private Sub DataGrid_MouseU p(ByVal sender As System.Object, ByVal e
As System.Windows. Forms.MouseEven tArgs) Handles dgProjectItem.M ouseUp

'If right mouse button was clicked and released, display
context menu assigned to the DataGrid.
If e.Button = MouseButtons.Ri ght Then
blnContextMenu = True
Call SetupContextMen u(cmnuGrid, "dgJobs", ImgJobs)
If gblShowMenu Then
cmnuGrid.TrackP opup(dgProjectI tem.PointToScre en(New
Point(e.X, e.Y)))
End If
End If

End Sub
Private Sub SetupCombos()
Dim strQuery As String
strQuery = "Exec spCmbJobStatus"
Call MyCombofunction s.SetComboDatas et(strQuery, MyDataset,
"JobStatusList" , GblConnectionSt ring2)
'use this dataset for the on form combo too
cboJobsStatus.D ataSource = MyDataset.Table s!JobStatuslist
cboJobsStatus.D isplayMember = "JobStatus"
cboJobsStatus.V alueMember = "JobStatusK ey"
strQuery = "Exec SPSelectDefault JobStatus"
cboJobsStatus.S electedValue = GetDefaultCombo Value(strQuery,
"DefaultJobStat us")

End Sub

Private Sub LoadJobs(ByVal IntProjectkey As Integer, ByVal
IntJobStatus As Integer)
Dim strquery As String
If IntJobStatus = -1 Then
IntJobStatus = CIntSelectAllJo bs 'commented out as it keeps
causing declaration problems. 3 = ALL job Status'
End If
Dim dsJobs As DataSet
dsJobs = MyDataset.Clone ()

'rds format the datagrid
Call MyDataAccess.Fi llsqlAdapter(My JobsNode.SQLQue ry, dsJobs,
"Jobs", GblConnectionSt ring2, MySqlDataAdapte r)
Call MyGridfunctions .LoadProjectIte msGrid(MyDatase t,
dgProjectItem, "Jobs")
Me.dgProjectIte m.DataSource = MyDataset.Table s("Jobs")
Call DisableAddRowTo Grid(dgProjectI tem)
AddHandler MyDataset.Table s.Item("Jobs"). RowDeleted, New
DataRowChangeEv entHandler(Addr essOf JobsCol_deleted )

End Sub

Private Sub JobsCol_deleted (ByVal sender As Object, ByVal e As
DataRowChangeEv entArgs)
Call WriteDebug("frm ProjectDetails" , "JobsCol_delete d")
System.Windows. Forms.Cursor.Cu rrent =
System.Windows. Forms.Cursors.W aitCursor
DirectCast(Bind ingContext(MyDa taset.Tables!Jo bs),
CurrencyManager ).EndCurrentEdi t()
Dim objCommandBuild er As New SqlCommandBuild er(MySqlDataAda pter)
'RCTEST - remove the NOT in the IF below
If Not MyDataAccess.Up dateDataSet(MyD ataset, MySqlDataAdapte r,
"Jobs") Then
Call mdiClient.Refre shProjectExplor er()
Call mdiClient.Selec tNode(CType(MyJ obsNode.Parent,
ProjectNode).Ke y.ToString, "JOBS", MyJobsNode.Key. ToString)
End If
System.Windows. Forms.Cursor.Cu rrent =
System.Windows. Forms.Cursors.D efault
End Sub

'Code: dgjobs_CurrentC ellchanged
Private Sub dgProjectItem_C urrentCellChang ed(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
dgProjectItem.C urrentCellChang ed
Call WriteDebug("frm Jobs", "dgJobs_Current CellChanged")
Call SetLayout()
DirectCast(Bind ingContext(MyDa taset.Tables.It em("Jobs")),
CurrencyManager ).EndCurrentEdi t()
Call MyDataAccess.Up dateDataSet(MyD ataset, MySqlDataAdapte r,
"Jobs")
'Call MyTree.SetLayou tPic(dgJobs(dgJ obs.CurrentCell .RowNumber,
IntJobdirCol))

End Sub
Private Sub SetLayout()
Dim IntJobDirCol As Integer
Dim IntRowNum As Integer = dgProjectItem.C urrentCell.RowN umber
IntJobDirCol =
CType(MyGridfun ctions.htcolumn list("JobDirect ory"), Integer)
Call SetLayoutPic(CT ype(dgProjectIt em(IntRowNum, IntJobDirCol),
String))
End Sub

Private Sub SetLayoutPic(By Val strJobDir As String)
Debug.WriteLine ("frmJobs: " & Now & " " & "*** SetLayoutPic -
strJobDir = " & strJobDir)
'sets the Layout picture
Dim stJobLayoutFile As String = strJobDir + "\LAST$LAY. LAY"

If Not IsDBNull(stJobL ayoutFile) Then
Me.AxOleLayout1 .FileName = stJobLayoutFile
Else
Me.AxOleLayout1 .FileName = ""
End If

End Sub
Private Sub dgProjectItem_C lick(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles dgProjectItem.C lick

Dim pt As Point = dgProjectItem.P ointToClient(Cu rsor.Position)
Dim hti As DataGrid.HitTes tInfo
hti = dgProjectItem.H itTest(pt)
If hti.Type = DataGrid.HitTes tType.RowHeader Then
DirectCast(Bind ingContext(MyDa taset.Tables.It em("Jobs")),
CurrencyManager ).EndCurrentEdi t()
Call MyDataAccess.Up dateDataSet(MyD ataset, MySqlDataAdapte r,
"Jobs")
End If

End Sub

Friend Function GetDefaultCombo Value(ByVal strQuery As String, ByVal
strRequiredFiel d As String) As Integer
Call WriteDebug("frm Jobs", "GetDefaultComb oValue")

Dim MyReader As SqlDataReader

MyReader = MyDataAccess.Cr eateDataReader( strQuery,
GblConnectionSt ring2)
If MyReader.HasRow s Then
While MyReader.Read
IntDefaultValue =
CType(DealWithN ulls(MyReader(s trRequiredField )), Integer)
End While

End If
Return IntDefaultValue

End Function
Public Sub HandleCellButto nClick(ByVal sender As Object, ByVal e As
DatagridColumns .DataGridButton .DataGridCellBu ttonClickEventA rgs)
Call WriteDebug("frm Jobs", "HandleCellButt onClick")
'rds this code is now in a seperate procedure so that it can be
called from projecttree
Call ActivateJob()

End Sub

Private Sub ActivateJob()
Dim IntRowNum, IntJobStatusCol , IntJobKeyCol As Integer
IntJobStatusCol = CType(Gridfunct ions.htcolumnli st("JobStatus") ,
Integer)

If UCase(CType(Gbl ProjectGrid(Int RowNum, IntJobStatusCol ),
String)) <> "LIVE" Then
MessageBox.Show ("Job's with a status of 'Dead' or
'Delivered' cannot be activated", "Job Activate Error", MessageBoxButto ns.OK,
MessageBoxIcon. Error)
Exit Sub
End If
IntJobKeyCol = CType(Gridfunct ions.htcolumnli st("JobKey"),
Integer)
ProjectNameSpac e.mdiClient.myJ obControl.Activ eJob =
CType(GblProjec tGrid(IntRowNum , IntJobKeyCol), Integer)
Dim MyCurrNode As JobSNode
MyCurrNode = CType(mdiClient .ProjectExplore r.SelectedNode,
JobSNode)
Call mdiClient.Refre shProjectExplor er()
Call mdiClient.Selec tNode(CType(MyC urrNode.Parent,
ProjectNode).Ke y.ToString, "JOBS", MyCurrNode.Key. ToString)

End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s)
Dim Myform As Form
Myform = New frmquotes
Myform.ShowDial og()
End Sub
End Class
End Namespace
Nov 21 '05 #3
Few things to try:

1. Make sure you created your base form using the designer as well. In your
example I don't see your generated code -- i.e. the dispose method is not
present, nor is the call to InitializeCompo nent (these run at design-time as
well)
2. Make sure any class level fields or methods that are being referenced in
the inherited forms are "friend" or "protected" . For the designer generated
fields, use the property sheet to modify the scope.
3. Any methods/properties you want to override in your inherited forms
should have the Overridable keyword in the base form.

HTH,
-B

"Geraldine Hobley" <Ge************ *@discussions.m icrosoft.com> wrote in
message news:F9******** *************** ***********@mic rosoft.com...
Hi Beth,
The code for the base form is as follows:
n.b some of the declarations have been left out to save space
Public Class ProjectItemForm
Inherits System.Windows. Forms.Form
Public Sub New()
End Sub
Protected WithEvents dgProjectItem As System.Windows. Forms.DataGrid
Public WithEvents tcProjectItem As
Crownwood.DotNe tMagic.Controls .ToolControl
Public WithEvents btnCJobs As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCQuotes As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCOrders As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCCalloffs As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCInvoices As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Public WithEvents btnCProjectDet As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Protected cmnuGrid As Crownwood.DotNe tMagic.Menus.Po pupMenu
Private CurrItem As CurrentItem
Public WithEvents ImgJobs As System.Windows. Forms.ImageList
Public WithEvents gpProjectInfo As System.Windows. Forms.GroupBox
Friend WithEvents bwsSearch As
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Public WithEvents ProjectSiteAddr ess As System.Windows. Forms.TextBox
Friend WithEvents lblAddress As System.Windows. Forms.Label
Public WithEvents ProjectSiteName As System.Windows. Forms.TextBox
Friend WithEvents LblSiteName As System.Windows. Forms.Label
Friend WithEvents bwsView As
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Public WithEvents tlProjectItem As System.Windows. Forms.ToolTip
Public WithEvents OEProjectItem As
Crownwood.DotNe tMagic.Controls .OfficeExtender
Friend WithEvents LblMarginMoney As System.Windows. Forms.Label
Friend WithEvents LblMarginPercen t As System.Windows. Forms.Label
Public WithEvents ctbMargin As CurrencyTextBox .CurrencyTextBo x
Public WithEvents PtxtMargin As Windows.Forms.T extBox
Friend WithEvents MenuControl1 As Crownwood.Magic .Menus.MenuCont rol
Me.dgProjectIte m = New System.Windows. Forms.DataGrid
Me.tcProjectIte m = New Crownwood.DotNe tMagic.Controls .ToolControl
Me.btnCProjectD et = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCJobs = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCQuotes = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCOrders = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCCalloffs = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCInvoices = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.ImgJobs = New System.Windows. Forms.ImageList (Me.components)
Me.gpProjectInf o = New System.Windows. Forms.GroupBox
Me.PtxtMargin = New System.Windows. Forms.TextBox
Me.ctbMargin = New CurrencyTextBox .CurrencyTextBo x
Me.LblMarginMon ey = New System.Windows. Forms.Label
Me.LblMarginPer cent = New System.Windows. Forms.Label
Me.bwsSearch = New Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Me.ProjectSiteA ddress = New System.Windows. Forms.TextBox
Me.lblAddress = New System.Windows. Forms.Label
Me.ProjectSiteN ame = New System.Windows. Forms.TextBox
Me.LblSiteName = New System.Windows. Forms.Label
Me.bwsView = New Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Me.tlProjectIte m = New System.Windows. Forms.ToolTip(M e.components)
Me.OEProjectIte m = New
Crownwood.DotNe tMagic.Controls .OfficeExtender (Me.components)
Me.MenuControl1 = New Crownwood.Magic .Menus.MenuCont rol
CType(Me.dgProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.tcProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
'dgProjectItem

The code for the child form is as follows
Imports ProjectList.Pro jectNameSpace.G ridfunctions.Da taGrids
Imports DirectoryNode
Imports System.Data.Sql Client
Namespace ProjectNameSpac e
Public Class frmJobs
Inherits ProjectItem_For m.ProjectItemFo rm

#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

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 bwsSetDefault As
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Friend WithEvents cboJobsStatus As System.Windows. Forms.ComboBox
Friend WithEvents TCJob As
Crownwood.DotNe tMagic.Controls .ToolControl
Friend WithEvents btnCCopyJob As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Friend WithEvents btnCQuoteNotes As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Friend WithEvents ToolControl1 As
Crownwood.DotNe tMagic.Controls .ToolControl
Friend WithEvents btnCNewJob As
Crownwood.DotNe tMagic.Controls .Command.Button Command
Friend WithEvents LblJobStatus As System.Windows. Forms.Label
Friend WithEvents AxOleLayout1 As AxOLELAYOUTLib. AxOleLayout
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Dim resources As System.Resource s.ResourceManag er = New
System.Resource s.ResourceManag er(GetType(frmJ obs))
Me.bwsSetDefaul t = New
Crownwood.DotNe tMagic.Controls .ButtonWithStyl e
Me.cboJobsStatu s = New System.Windows. Forms.ComboBox
Me.TCJob = New Crownwood.DotNe tMagic.Controls .ToolControl
Me.btnCCopyJob = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.btnCQuoteNot es = New
Crownwood.DotNe tMagic.Controls .Command.Button Command
Me.ToolControl1 = New
Crownwood.DotNe tMagic.Controls .ToolControl
Me.LblJobStatus = New System.Windows. Forms.Label
Me.AxOleLayout1 = New AxOLELAYOUTLib. AxOleLayout
Me.gpProjectInf o.SuspendLayout ()
CType(Me.dgProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.tcProj ectItem,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.TCJob,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.ToolCo ntrol1,
System.Componen tModel.ISupport Initialize).Beg inInit()
CType(Me.AxOleL ayout1,
System.Componen tModel.ISupport Initialize).Beg inInit()
Me.SuspendLayou t()
'
'PtxtMargin
'
Me.PtxtMargin.N ame = "PtxtMargin "
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Pt xtMargin,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'ctbMargin
'
Me.ctbMargin.Na me = "ctbMargin"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.ct bMargin,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'gpProjectInfo
'
Me.gpProjectInf o.Name = "gpProjectI nfo"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.gp ProjectInfo,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'dgProjectItem
'
Me.dgProjectIte m.Anchor =
CType(((System. Windows.Forms.A nchorStyles.Top Or
System.Windows. Forms.AnchorSty les.Left) _
Or System.Windows. Forms.AnchorSty les.Right),
System.Windows. Forms.AnchorSty les)
Me.dgProjectIte m.Name = "dgProjectI tem"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.dg ProjectItem,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.dgProjectIte m.Size = New System.Drawing. Size(648, 184)
'
'tcProjectItem
'
Me.tcProjectIte m.Name = "tcProjectI tem"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.tc ProjectItem,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'ProjectSiteNam e
'
Me.ProjectSiteN ame.Name = "ProjectSiteNam e"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Pr ojectSiteName,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
'
'ProjectSiteAdd ress
'
Me.ProjectSiteA ddress.Name = "ProjectSiteAdd ress"
'
'bwsSetDefault
'
Me.bwsSetDefaul t.BackColor =
System.Drawing. Color.FromArgb( CType(195, Byte), CType(218, Byte),
CType(249,
Byte))
Me.bwsSetDefaul t.Location = New System.Drawing. Point(200, 128)
Me.bwsSetDefaul t.Name = "bwsSetDefa ult"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.bw sSetDefault,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.bwsSetDefaul t.Size = New System.Drawing. Size(60, 21)
Me.bwsSetDefaul t.TabIndex = 6
Me.bwsSetDefaul t.Text = "Set &Default"
Me.bwsSetDefaul t.TextEdge =
Crownwood.DotNe tMagic.Common.T extEdge.Left
'
'cboJobsStatus
'
Me.cboJobsStatu s.DropDownStyle =
System.Windows. Forms.ComboBoxS tyle.DropDownLi st
Me.cboJobsStatu s.Location = New System.Drawing. Point(88, 128)
Me.cboJobsStatu s.Name = "cboJobsSta tus"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.cb oJobsStatus,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.cboJobsStatu s.Size = New System.Drawing. Size(104, 21)
Me.cboJobsStatu s.TabIndex = 5
'
'TCJob
'
Me.TCJob.Dock = System.Windows. Forms.DockStyle .Bottom
Me.TCJob.Locati on = New System.Drawing. Point(0, 552)
Me.TCJob.Name = "TCJob"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.TC Job,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.TCJob.Size = New System.Drawing. Size(860, 4)
Me.TCJob.TabInd ex = 11
'
'btnCCopyJob
'
Me.btnCCopyJob. Image =
CType(resources .GetObject("btn CCopyJob.Image" ), System.Drawing. Image)
Me.btnCCopyJob. Tag = Nothing
Me.btnCCopyJob. Text = "Copy Job"
'
'btnCQuoteNotes
'
Me.btnCQuoteNot es.Image =
CType(resources .GetObject("btn CQuoteNotes.Ima ge"), System.Drawing. Image)
Me.btnCQuoteNot es.Tag = Nothing
Me.btnCQuoteNot es.Text = "Quote Notes"
'
'ToolControl1
'
Me.ToolControl1 .Dock = System.Windows. Forms.DockStyle .Bottom
Me.ToolControl1 .Location = New System.Drawing. Point(0, 556)
Me.ToolControl1 .Name = "ToolContro l1"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.To olControl1,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.ToolControl1 .Size = New System.Drawing. Size(860, 4)
Me.ToolControl1 .TabIndex = 12
'
'LblJobStatus
'
Me.LblJobStatus .BackColor =
System.Drawing. Color.FromArgb( CType(195, Byte), CType(218, Byte),
CType(249,
Byte))
Me.LblJobStatus .Location = New System.Drawing. Point(16, 128)
Me.LblJobStatus .Name = "LblJobStat us"
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Lb lJobStatus,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.LblJobStatus .Size = New System.Drawing. Size(64, 16)
Me.LblJobStatus .TabIndex = 13
Me.LblJobStatus .Text = "Job Status:"
Me.LblJobStatus .TextAlign =
System.Drawing. ContentAlignmen t.BottomLeft
'
'AxOleLayout1
'
Me.AxOleLayout1 .Enabled = True
Me.AxOleLayout1 .Location = New System.Drawing. Point(32, 368)
Me.AxOleLayout1 .Name = "AxOleLayou t1"
Me.AxOleLayout1 .OcxState =
CType(resources .GetObject("AxO leLayout1.OcxSt ate"),
System.Windows. Forms.AxHost.St ate)
Me.OEProjectIte m.SetOffice2003 BackColor(Me.Ax OleLayout1,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Disable)
Me.AxOleLayout1 .Size = New System.Drawing. Size(264, 184)
Me.AxOleLayout1 .TabIndex = 14
'
'frmJobs
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(798, 529)
Me.Controls.Add (Me.AxOleLayout 1)
Me.Controls.Add (Me.LblJobStatu s)
Me.Controls.Add (Me.TCJob)
Me.Controls.Add (Me.bwsSetDefau lt)
Me.Controls.Add (Me.cboJobsStat us)
Me.Controls.Add (Me.ToolControl 1)
Me.Location = New System.Drawing. Point(0, 0)
Me.Name = "frmJobs"
Me.OEProjectIte m.SetOffice2003 BackColor(Me,
Crownwood.DotNe tMagic.Controls .Office2003Colo r.Base)
Me.Controls.Set ChildIndex(Me.T oolControl1, 0)
Me.Controls.Set ChildIndex(Me.d gProjectItem, 0)
Me.Controls.Set ChildIndex(Me.t cProjectItem, 0)
Me.Controls.Set ChildIndex(Me.g pProjectInfo, 0)
Me.Controls.Set ChildIndex(Me.c boJobsStatus, 0)
Me.Controls.Set ChildIndex(Me.b wsSetDefault, 0)
Me.Controls.Set ChildIndex(Me.T CJob, 0)
Me.Controls.Set ChildIndex(Me.L blJobStatus, 0)
Me.Controls.Set ChildIndex(Me.A xOleLayout1, 0)
Me.gpProjectInf o.ResumeLayout( False)
CType(Me.dgProj ectItem,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.tcProj ectItem,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.TCJob,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.ToolCo ntrol1,
System.Componen tModel.ISupport Initialize).End Init()
CType(Me.AxOleL ayout1,
System.Componen tModel.ISupport Initialize).End Init()
Me.ResumeLayout (False)

End Sub

#End Region

Private MyCombofunction s As New ComboFunctions
Private MyDataAccess As New DataAccess.Data Access
Private blnGridFormatte d As Boolean
Private MyGridfunctions As New Gridfunctions
Private MyDataset As New DataSet
Private dsJobs As New DataSet
Private MyJobsNode As DirectoryNode.J obSNode
Private MySqlDataAdapte r As SqlDataAdapter
Private IntDefaultValue As Integer
Friend Const CIntSelectAllJo bs As Integer = 3
Friend IntJobStatus As Integer
Friend MyProjectInfoTa ble As DataTable
Private blnContextMenu As Boolean = False

Private Sub frmJobs_Load(By Val sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim blnGridformatte d As Boolean
Me.tcProjectIte m.Commands.Remo ve(Me.btnCJobs)
Call SetupCombos()
MyGridFunctions .MydataGrid = dgProjectItem
blnGridformatte d = MyGridFunctions .FormatDataGrid (Jobs, "Jobs",
MyDataset)
GblProjectGrid = Me.dgProjectIte m
End Sub

Public Sub LoadData(ByVal MyNode As JobSNode)
MyDataset = MyNode.DataSet
MyJobsNode = MyNode
Call LoadJobs(MyNode .ProjectKey,
CType(cboJobsSt atus.SelectedVa lue, Integer))
Dim MyParentNode As ProjectNode
MyParentNode = CType(MyNode.Pa rent, ProjectNode)
MyProjectInfoTa ble = MyParentNode.Da taSet.Tables("P rojectInfo")
If MyDataset.Table s("Jobs").Rows. Count > 0 Then
Call SetLayout()
End If
Call BindProjectInfo (MyProjectInfoT able)
Call BindNonTextFiel ds(MyProjectInf oTable)
End Sub

Private Sub BindNonTextFiel ds(ByRef MyDatatable As DataTable)
Call BindCurrencyFie ld("Text", MyDatatable, "MarginMone y",
Me.ctbMargin)
End Sub

Private Sub DataGrid_MouseU p(ByVal sender As System.Object, ByVal e
As System.Windows. Forms.MouseEven tArgs) Handles dgProjectItem.M ouseUp

'If right mouse button was clicked and released, display
context menu assigned to the DataGrid.
If e.Button = MouseButtons.Ri ght Then
blnContextMenu = True
Call SetupContextMen u(cmnuGrid, "dgJobs", ImgJobs)
If gblShowMenu Then
cmnuGrid.TrackP opup(dgProjectI tem.PointToScre en(New
Point(e.X, e.Y)))
End If
End If

End Sub
Private Sub SetupCombos()
Dim strQuery As String
strQuery = "Exec spCmbJobStatus"
Call MyCombofunction s.SetComboDatas et(strQuery, MyDataset,
"JobStatusList" , GblConnectionSt ring2)
'use this dataset for the on form combo too
cboJobsStatus.D ataSource = MyDataset.Table s!JobStatuslist
cboJobsStatus.D isplayMember = "JobStatus"
cboJobsStatus.V alueMember = "JobStatusK ey"
strQuery = "Exec SPSelectDefault JobStatus"
cboJobsStatus.S electedValue = GetDefaultCombo Value(strQuery,
"DefaultJobStat us")

End Sub

Private Sub LoadJobs(ByVal IntProjectkey As Integer, ByVal
IntJobStatus As Integer)
Dim strquery As String
If IntJobStatus = -1 Then
IntJobStatus = CIntSelectAllJo bs 'commented out as it keeps
causing declaration problems. 3 = ALL job Status'
End If
Dim dsJobs As DataSet
dsJobs = MyDataset.Clone ()

'rds format the datagrid
Call MyDataAccess.Fi llsqlAdapter(My JobsNode.SQLQue ry, dsJobs,
"Jobs", GblConnectionSt ring2, MySqlDataAdapte r)
Call MyGridfunctions .LoadProjectIte msGrid(MyDatase t,
dgProjectItem, "Jobs")
Me.dgProjectIte m.DataSource = MyDataset.Table s("Jobs")
Call DisableAddRowTo Grid(dgProjectI tem)
AddHandler MyDataset.Table s.Item("Jobs"). RowDeleted, New
DataRowChangeEv entHandler(Addr essOf JobsCol_deleted )

End Sub

Private Sub JobsCol_deleted (ByVal sender As Object, ByVal e As
DataRowChangeEv entArgs)
Call WriteDebug("frm ProjectDetails" , "JobsCol_delete d")
System.Windows. Forms.Cursor.Cu rrent =
System.Windows. Forms.Cursors.W aitCursor
DirectCast(Bind ingContext(MyDa taset.Tables!Jo bs),
CurrencyManager ).EndCurrentEdi t()
Dim objCommandBuild er As New
SqlCommandBuild er(MySqlDataAda pter)
'RCTEST - remove the NOT in the IF below
If Not MyDataAccess.Up dateDataSet(MyD ataset, MySqlDataAdapte r,
"Jobs") Then
Call mdiClient.Refre shProjectExplor er()
Call mdiClient.Selec tNode(CType(MyJ obsNode.Parent,
ProjectNode).Ke y.ToString, "JOBS", MyJobsNode.Key. ToString)
End If
System.Windows. Forms.Cursor.Cu rrent =
System.Windows. Forms.Cursors.D efault
End Sub

'Code: dgjobs_CurrentC ellchanged
Private Sub dgProjectItem_C urrentCellChang ed(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
dgProjectItem.C urrentCellChang ed
Call WriteDebug("frm Jobs", "dgJobs_Current CellChanged")
Call SetLayout()
DirectCast(Bind ingContext(MyDa taset.Tables.It em("Jobs")),
CurrencyManager ).EndCurrentEdi t()
Call MyDataAccess.Up dateDataSet(MyD ataset, MySqlDataAdapte r,
"Jobs")
'Call MyTree.SetLayou tPic(dgJobs(dgJ obs.CurrentCell .RowNumber,
IntJobdirCol))

End Sub
Private Sub SetLayout()
Dim IntJobDirCol As Integer
Dim IntRowNum As Integer = dgProjectItem.C urrentCell.RowN umber
IntJobDirCol =
CType(MyGridfun ctions.htcolumn list("JobDirect ory"), Integer)
Call SetLayoutPic(CT ype(dgProjectIt em(IntRowNum, IntJobDirCol),
String))
End Sub

Private Sub SetLayoutPic(By Val strJobDir As String)
Debug.WriteLine ("frmJobs: " & Now & " " & "*** SetLayoutPic -
strJobDir = " & strJobDir)
'sets the Layout picture
Dim stJobLayoutFile As String = strJobDir + "\LAST$LAY. LAY"

If Not IsDBNull(stJobL ayoutFile) Then
Me.AxOleLayout1 .FileName = stJobLayoutFile
Else
Me.AxOleLayout1 .FileName = ""
End If

End Sub
Private Sub dgProjectItem_C lick(ByVal sender As System.Object,
ByVal
e As System.EventArg s) Handles dgProjectItem.C lick

Dim pt As Point = dgProjectItem.P ointToClient(Cu rsor.Position)
Dim hti As DataGrid.HitTes tInfo
hti = dgProjectItem.H itTest(pt)
If hti.Type = DataGrid.HitTes tType.RowHeader Then
DirectCast(Bind ingContext(MyDa taset.Tables.It em("Jobs")),
CurrencyManager ).EndCurrentEdi t()
Call MyDataAccess.Up dateDataSet(MyD ataset,
MySqlDataAdapte r,
"Jobs")
End If

End Sub

Friend Function GetDefaultCombo Value(ByVal strQuery As String,
ByVal
strRequiredFiel d As String) As Integer
Call WriteDebug("frm Jobs", "GetDefaultComb oValue")

Dim MyReader As SqlDataReader

MyReader = MyDataAccess.Cr eateDataReader( strQuery,
GblConnectionSt ring2)
If MyReader.HasRow s Then
While MyReader.Read
IntDefaultValue =
CType(DealWithN ulls(MyReader(s trRequiredField )), Integer)
End While

End If
Return IntDefaultValue

End Function
Public Sub HandleCellButto nClick(ByVal sender As Object, ByVal e As
DatagridColumns .DataGridButton .DataGridCellBu ttonClickEventA rgs)
Call WriteDebug("frm Jobs", "HandleCellButt onClick")
'rds this code is now in a seperate procedure so that it can be
called from projecttree
Call ActivateJob()

End Sub

Private Sub ActivateJob()
Dim IntRowNum, IntJobStatusCol , IntJobKeyCol As Integer
IntJobStatusCol =
CType(Gridfunct ions.htcolumnli st("JobStatus") ,
Integer)

If UCase(CType(Gbl ProjectGrid(Int RowNum, IntJobStatusCol ),
String)) <> "LIVE" Then
MessageBox.Show ("Job's with a status of 'Dead' or
'Delivered' cannot be activated", "Job Activate Error",
MessageBoxButto ns.OK,
MessageBoxIcon. Error)
Exit Sub
End If
IntJobKeyCol = CType(Gridfunct ions.htcolumnli st("JobKey"),
Integer)
ProjectNameSpac e.mdiClient.myJ obControl.Activ eJob =
CType(GblProjec tGrid(IntRowNum , IntJobKeyCol), Integer)
Dim MyCurrNode As JobSNode
MyCurrNode = CType(mdiClient .ProjectExplore r.SelectedNode,
JobSNode)
Call mdiClient.Refre shProjectExplor er()
Call mdiClient.Selec tNode(CType(MyC urrNode.Parent,
ProjectNode).Ke y.ToString, "JOBS", MyCurrNode.Key. ToString)

End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s)
Dim Myform As Form
Myform = New frmquotes
Myform.ShowDial og()
End Sub
End Class
End Namespace

Nov 21 '05 #4

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

Similar topics

3
2665
by: thechaosengine | last post by:
Hi all, I wanted to put some common security functions into a class that inherits from the Page class and then use the new class as the basis for all my pages. Unfortunately, if I try and inherit from my new SecurePage class and not the old Page class, the designer breaks and will only allow me into html mode. Bugger. The error message given is:
1
1419
by: Rasmus Kromann-Larsen | last post by:
Hey, I'm working on an application (questionaire) with alot of different question types (very different form layout)... But the questions share attributes, however - since I'm working in the .NET Compact Framework that doesn't support Inheriting Forms, and a form is required to inherit System.Windows.Forms.Form - and can only extend one class, how am I to build the thing without having to repeat my shared attributes (can make an...
5
1317
by: Robert A. Boudra | last post by:
I was working through one of the examples in Microsoft's VB.net resource kit, following the instructions for adding an inherited form to a project. The base form had a couple of Buttons one it. When I choose the "add inherited form" option and select the base form, it creates a new instance of the form just fine. I then added some additional controls to the new form, and selected the Build option. As soon as the Build option is...
2
1813
by: Charles Law | last post by:
I want a set of controls that all have a border, like a group box. I thought I would create a base control containing just a group box from which my set of controls could inherit. Assuming that this is the right approach (please tell me if it is not), how then do I make it so that the group box cannot be moved around on my set of controls, but is also able to act as container for other controls? If I leave the modifier of the group box...
3
1174
by: YYZ | last post by:
I'm new to VB.net, but not new to OO in general, and I'm very strong in VB6. However, I don't know what I did in VB.net to cause this to happen. I've got 2 projects open at the same time, in the same solution. One is a Class Library project that contains 1 form and 1 class. The other project is a normal Windows app, and contains 2 forms, both inherited from the form in the class library, by adding the line "Inherits...
3
2369
by: johnb41 | last post by:
In my treeview, I need each node to hold a "value", not just text/label. Kind of like how a ListBox item has text, and a value associated with it. I need this because when a node is clicked, i need to get the "value" behind the node and then use it do do something. Anyway, I made a custom treenode class that inherits from Treenode, and added a property called "value". I was able to successfully create the Treeview programmatically...
3
5383
by: Alex Satrapa | last post by:
There's some mention in the (old!) documentation that constraints such as foreign keys won't include data from inheriting tables, eg: CREATE TABLE foo ( id SERIAL PRIMARY KEY ); CREATE TABLE bar ( attribute integer NOT NULL ) INHERITS (foo);
7
4964
by: Vish | last post by:
Hi, I have a base form from which i want all of my forms to inherit from. The base form has three buttons anchored to the bottom right of the base form. When i first inherit a new form from the base form everything seems to be fine. The 3 buttons from the base form show up on the bottom right of the inherited form. But as i started adding new controls and building it i found that the 3 buttons from the base form disappeared. When i...
5
1924
by: UJ | last post by:
I have a user control that inherits from the standard windows text box. I have a routine that adds stuff to it. I have compiled it into a dll. I have added it to my app and I can debug into it. I can see that the text changes but it doesn't actually update on the screen (the text itself is correct in the routine in the object but the display is wrong.) I've tried invalidating the object after I change the text but it still doesn't display...
0
8968
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8787
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6750
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
6053
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
4569
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...
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
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.