|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Inheriting forms problemHello,
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 Could you post the code for your base class form and your inherited form?
Show quoteHide quote "Geraldine Hobley" <GeraldineHob***@discussions.microsoft.com> wrote in message news:9F2D3C71-762D-4D1D-AFA8-48F569292A67@microsoft.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 > 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.DotNetMagic.Controls.ToolControl Public WithEvents btnCJobs As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Public WithEvents btnCQuotes As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Public WithEvents btnCOrders As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Public WithEvents btnCCalloffs As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Public WithEvents btnCInvoices As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Public WithEvents btnCProjectDet As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Protected cmnuGrid As Crownwood.DotNetMagic.Menus.PopupMenu 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.DotNetMagic.Controls.ButtonWithStyle Public WithEvents ProjectSiteAddress 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.DotNetMagic.Controls.ButtonWithStyle Public WithEvents tlProjectItem As System.Windows.Forms.ToolTip Public WithEvents OEProjectItem As Crownwood.DotNetMagic.Controls.OfficeExtender Friend WithEvents LblMarginMoney As System.Windows.Forms.Label Friend WithEvents LblMarginPercent As System.Windows.Forms.Label Public WithEvents ctbMargin As CurrencyTextBox.CurrencyTextBox Public WithEvents PtxtMargin As Windows.Forms.TextBox Friend WithEvents MenuControl1 As Crownwood.Magic.Menus.MenuControl Me.dgProjectItem = New System.Windows.Forms.DataGrid Me.tcProjectItem = New Crownwood.DotNetMagic.Controls.ToolControl Me.btnCProjectDet = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.btnCJobs = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.btnCQuotes = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.btnCOrders = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.btnCCalloffs = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.btnCInvoices = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.ImgJobs = New System.Windows.Forms.ImageList(Me.components) Me.gpProjectInfo = New System.Windows.Forms.GroupBox Me.PtxtMargin = New System.Windows.Forms.TextBox Me.ctbMargin = New CurrencyTextBox.CurrencyTextBox Me.LblMarginMoney = New System.Windows.Forms.Label Me.LblMarginPercent = New System.Windows.Forms.Label Me.bwsSearch = New Crownwood.DotNetMagic.Controls.ButtonWithStyle Me.ProjectSiteAddress = New System.Windows.Forms.TextBox Me.lblAddress = New System.Windows.Forms.Label Me.ProjectSiteName = New System.Windows.Forms.TextBox Me.LblSiteName = New System.Windows.Forms.Label Me.bwsView = New Crownwood.DotNetMagic.Controls.ButtonWithStyle Me.tlProjectItem = New System.Windows.Forms.ToolTip(Me.components) Me.OEProjectItem = New Crownwood.DotNetMagic.Controls.OfficeExtender(Me.components) Me.MenuControl1 = New Crownwood.Magic.Menus.MenuControl CType(Me.dgProjectItem, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.tcProjectItem, System.ComponentModel.ISupportInitialize).BeginInit() 'dgProjectItem The code for the child form is as follows Imports ProjectList.ProjectNameSpace.Gridfunctions.DataGrids Imports DirectoryNode Imports System.Data.SqlClient Namespace ProjectNameSpace Public Class frmJobs Inherits ProjectItem_Form.ProjectItemForm #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() 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.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer '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.DotNetMagic.Controls.ButtonWithStyle Friend WithEvents cboJobsStatus As System.Windows.Forms.ComboBox Friend WithEvents TCJob As Crownwood.DotNetMagic.Controls.ToolControl Friend WithEvents btnCCopyJob As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Friend WithEvents btnCQuoteNotes As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Friend WithEvents ToolControl1 As Crownwood.DotNetMagic.Controls.ToolControl Friend WithEvents btnCNewJob As Crownwood.DotNetMagic.Controls.Command.ButtonCommand Friend WithEvents LblJobStatus As System.Windows.Forms.Label Friend WithEvents AxOleLayout1 As AxOLELAYOUTLib.AxOleLayout <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmJobs)) Me.bwsSetDefault = New Crownwood.DotNetMagic.Controls.ButtonWithStyle Me.cboJobsStatus = New System.Windows.Forms.ComboBox Me.TCJob = New Crownwood.DotNetMagic.Controls.ToolControl Me.btnCCopyJob = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.btnCQuoteNotes = New Crownwood.DotNetMagic.Controls.Command.ButtonCommand Me.ToolControl1 = New Crownwood.DotNetMagic.Controls.ToolControl Me.LblJobStatus = New System.Windows.Forms.Label Me.AxOleLayout1 = New AxOLELAYOUTLib.AxOleLayout Me.gpProjectInfo.SuspendLayout() CType(Me.dgProjectItem, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.tcProjectItem, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TCJob, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ToolControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.AxOleLayout1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'PtxtMargin ' Me.PtxtMargin.Name = "PtxtMargin" Me.OEProjectItem.SetOffice2003BackColor(Me.PtxtMargin, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) ' 'ctbMargin ' Me.ctbMargin.Name = "ctbMargin" Me.OEProjectItem.SetOffice2003BackColor(Me.ctbMargin, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) ' 'gpProjectInfo ' Me.gpProjectInfo.Name = "gpProjectInfo" Me.OEProjectItem.SetOffice2003BackColor(Me.gpProjectInfo, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) ' 'dgProjectItem ' Me.dgProjectItem.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.dgProjectItem.Name = "dgProjectItem" Me.OEProjectItem.SetOffice2003BackColor(Me.dgProjectItem, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) Me.dgProjectItem.Size = New System.Drawing.Size(648, 184) ' 'tcProjectItem ' Me.tcProjectItem.Name = "tcProjectItem" Me.OEProjectItem.SetOffice2003BackColor(Me.tcProjectItem, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) ' 'ProjectSiteName ' Me.ProjectSiteName.Name = "ProjectSiteName" Me.OEProjectItem.SetOffice2003BackColor(Me.ProjectSiteName, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) ' 'ProjectSiteAddress ' Me.ProjectSiteAddress.Name = "ProjectSiteAddress" ' 'bwsSetDefault ' Me.bwsSetDefault.BackColor = System.Drawing.Color.FromArgb(CType(195, Byte), CType(218, Byte), CType(249, Byte)) Me.bwsSetDefault.Location = New System.Drawing.Point(200, 128) Me.bwsSetDefault.Name = "bwsSetDefault" Me.OEProjectItem.SetOffice2003BackColor(Me.bwsSetDefault, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) Me.bwsSetDefault.Size = New System.Drawing.Size(60, 21) Me.bwsSetDefault.TabIndex = 6 Me.bwsSetDefault.Text = "Set &Default" Me.bwsSetDefault.TextEdge = Crownwood.DotNetMagic.Common.TextEdge.Left ' 'cboJobsStatus ' Me.cboJobsStatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.cboJobsStatus.Location = New System.Drawing.Point(88, 128) Me.cboJobsStatus.Name = "cboJobsStatus" Me.OEProjectItem.SetOffice2003BackColor(Me.cboJobsStatus, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) Me.cboJobsStatus.Size = New System.Drawing.Size(104, 21) Me.cboJobsStatus.TabIndex = 5 ' 'TCJob ' Me.TCJob.Dock = System.Windows.Forms.DockStyle.Bottom Me.TCJob.Location = New System.Drawing.Point(0, 552) Me.TCJob.Name = "TCJob" Me.OEProjectItem.SetOffice2003BackColor(Me.TCJob, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) Me.TCJob.Size = New System.Drawing.Size(860, 4) Me.TCJob.TabIndex = 11 ' 'btnCCopyJob ' Me.btnCCopyJob.Image = CType(resources.GetObject("btnCCopyJob.Image"), System.Drawing.Image) Me.btnCCopyJob.Tag = Nothing Me.btnCCopyJob.Text = "Copy Job" ' 'btnCQuoteNotes ' Me.btnCQuoteNotes.Image = CType(resources.GetObject("btnCQuoteNotes.Image"), System.Drawing.Image) Me.btnCQuoteNotes.Tag = Nothing Me.btnCQuoteNotes.Text = "Quote Notes" ' 'ToolControl1 ' Me.ToolControl1.Dock = System.Windows.Forms.DockStyle.Bottom Me.ToolControl1.Location = New System.Drawing.Point(0, 556) Me.ToolControl1.Name = "ToolControl1" Me.OEProjectItem.SetOffice2003BackColor(Me.ToolControl1, Crownwood.DotNetMagic.Controls.Office2003Color.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 = "LblJobStatus" Me.OEProjectItem.SetOffice2003BackColor(Me.LblJobStatus, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) Me.LblJobStatus.Size = New System.Drawing.Size(64, 16) Me.LblJobStatus.TabIndex = 13 Me.LblJobStatus.Text = "Job Status:" Me.LblJobStatus.TextAlign = System.Drawing.ContentAlignment.BottomLeft ' 'AxOleLayout1 ' Me.AxOleLayout1.Enabled = True Me.AxOleLayout1.Location = New System.Drawing.Point(32, 368) Me.AxOleLayout1.Name = "AxOleLayout1" Me.AxOleLayout1.OcxState = CType(resources.GetObject("AxOleLayout1.OcxState"), System.Windows.Forms.AxHost.State) Me.OEProjectItem.SetOffice2003BackColor(Me.AxOleLayout1, Crownwood.DotNetMagic.Controls.Office2003Color.Disable) Me.AxOleLayout1.Size = New System.Drawing.Size(264, 184) Me.AxOleLayout1.TabIndex = 14 ' 'frmJobs ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(798, 529) Me.Controls.Add(Me.AxOleLayout1) Me.Controls.Add(Me.LblJobStatus) Me.Controls.Add(Me.TCJob) Me.Controls.Add(Me.bwsSetDefault) Me.Controls.Add(Me.cboJobsStatus) Me.Controls.Add(Me.ToolControl1) Me.Location = New System.Drawing.Point(0, 0) Me.Name = "frmJobs" Me.OEProjectItem.SetOffice2003BackColor(Me, Crownwood.DotNetMagic.Controls.Office2003Color.Base) Me.Controls.SetChildIndex(Me.ToolControl1, 0) Me.Controls.SetChildIndex(Me.dgProjectItem, 0) Me.Controls.SetChildIndex(Me.tcProjectItem, 0) Me.Controls.SetChildIndex(Me.gpProjectInfo, 0) Me.Controls.SetChildIndex(Me.cboJobsStatus, 0) Me.Controls.SetChildIndex(Me.bwsSetDefault, 0) Me.Controls.SetChildIndex(Me.TCJob, 0) Me.Controls.SetChildIndex(Me.LblJobStatus, 0) Me.Controls.SetChildIndex(Me.AxOleLayout1, 0) Me.gpProjectInfo.ResumeLayout(False) CType(Me.dgProjectItem, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.tcProjectItem, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TCJob, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.ToolControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.AxOleLayout1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private MyCombofunctions As New ComboFunctions Private MyDataAccess As New DataAccess.DataAccess Private blnGridFormatted As Boolean Private MyGridfunctions As New Gridfunctions Private MyDataset As New DataSet Private dsJobs As New DataSet Private MyJobsNode As DirectoryNode.JobSNode Private MySqlDataAdapter As SqlDataAdapter Private IntDefaultValue As Integer Friend Const CIntSelectAllJobs As Integer = 3 Friend IntJobStatus As Integer Friend MyProjectInfoTable As DataTable Private blnContextMenu As Boolean = False Private Sub frmJobs_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim blnGridformatted As Boolean Me.tcProjectItem.Commands.Remove(Me.btnCJobs) Call SetupCombos() MyGridFunctions.MydataGrid = dgProjectItem blnGridformatted = MyGridFunctions.FormatDataGrid(Jobs, "Jobs", MyDataset) GblProjectGrid = Me.dgProjectItem End Sub Public Sub LoadData(ByVal MyNode As JobSNode) MyDataset = MyNode.DataSet MyJobsNode = MyNode Call LoadJobs(MyNode.ProjectKey, CType(cboJobsStatus.SelectedValue, Integer)) Dim MyParentNode As ProjectNode MyParentNode = CType(MyNode.Parent, ProjectNode) MyProjectInfoTable = MyParentNode.DataSet.Tables("ProjectInfo") If MyDataset.Tables("Jobs").Rows.Count > 0 Then Call SetLayout() End If Call BindProjectInfo(MyProjectInfoTable) Call BindNonTextFields(MyProjectInfoTable) End Sub Private Sub BindNonTextFields(ByRef MyDatatable As DataTable) Call BindCurrencyField("Text", MyDatatable, "MarginMoney", Me.ctbMargin) End Sub Private Sub DataGrid_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgProjectItem.MouseUp 'If right mouse button was clicked and released, display context menu assigned to the DataGrid. If e.Button = MouseButtons.Right Then blnContextMenu = True Call SetupContextMenu(cmnuGrid, "dgJobs", ImgJobs) If gblShowMenu Then cmnuGrid.TrackPopup(dgProjectItem.PointToScreen(New Point(e.X, e.Y))) End If End If End Sub Private Sub SetupCombos() Dim strQuery As String strQuery = "Exec spCmbJobStatus" Call MyCombofunctions.SetComboDataset(strQuery, MyDataset, "JobStatusList", GblConnectionString2) 'use this dataset for the on form combo too cboJobsStatus.DataSource = MyDataset.Tables!JobStatuslist cboJobsStatus.DisplayMember = "JobStatus" cboJobsStatus.ValueMember = "JobStatusKey" strQuery = "Exec SPSelectDefaultJobStatus" cboJobsStatus.SelectedValue = GetDefaultComboValue(strQuery, "DefaultJobStatus") End Sub Private Sub LoadJobs(ByVal IntProjectkey As Integer, ByVal IntJobStatus As Integer) Dim strquery As String If IntJobStatus = -1 Then IntJobStatus = CIntSelectAllJobs '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.FillsqlAdapter(MyJobsNode.SQLQuery, dsJobs, "Jobs", GblConnectionString2, MySqlDataAdapter) Call MyGridfunctions.LoadProjectItemsGrid(MyDataset, dgProjectItem, "Jobs") Me.dgProjectItem.DataSource = MyDataset.Tables("Jobs") Call DisableAddRowToGrid(dgProjectItem) AddHandler MyDataset.Tables.Item("Jobs").RowDeleted, New DataRowChangeEventHandler(AddressOf JobsCol_deleted) End Sub Private Sub JobsCol_deleted(ByVal sender As Object, ByVal e As DataRowChangeEventArgs) Call WriteDebug("frmProjectDetails", "JobsCol_deleted") System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor DirectCast(BindingContext(MyDataset.Tables!Jobs), CurrencyManager).EndCurrentEdit() Dim objCommandBuilder As New SqlCommandBuilder(MySqlDataAdapter) 'RCTEST - remove the NOT in the IF below If Not MyDataAccess.UpdateDataSet(MyDataset, MySqlDataAdapter, "Jobs") Then Call mdiClient.RefreshProjectExplorer() Call mdiClient.SelectNode(CType(MyJobsNode.Parent, ProjectNode).Key.ToString, "JOBS", MyJobsNode.Key.ToString) End If System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default End Sub 'Code: dgjobs_CurrentCellchanged Private Sub dgProjectItem_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgProjectItem.CurrentCellChanged Call WriteDebug("frmJobs", "dgJobs_CurrentCellChanged") Call SetLayout() DirectCast(BindingContext(MyDataset.Tables.Item("Jobs")), CurrencyManager).EndCurrentEdit() Call MyDataAccess.UpdateDataSet(MyDataset, MySqlDataAdapter, "Jobs") 'Call MyTree.SetLayoutPic(dgJobs(dgJobs.CurrentCell.RowNumber, IntJobdirCol)) End Sub Private Sub SetLayout() Dim IntJobDirCol As Integer Dim IntRowNum As Integer = dgProjectItem.CurrentCell.RowNumber IntJobDirCol = CType(MyGridfunctions.htcolumnlist("JobDirectory"), Integer) Call SetLayoutPic(CType(dgProjectItem(IntRowNum, IntJobDirCol), String)) End Sub Private Sub SetLayoutPic(ByVal 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(stJobLayoutFile) Then Me.AxOleLayout1.FileName = stJobLayoutFile Else Me.AxOleLayout1.FileName = "" End If End Sub Private Sub dgProjectItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgProjectItem.Click Dim pt As Point = dgProjectItem.PointToClient(Cursor.Position) Dim hti As DataGrid.HitTestInfo hti = dgProjectItem.HitTest(pt) If hti.Type = DataGrid.HitTestType.RowHeader Then DirectCast(BindingContext(MyDataset.Tables.Item("Jobs")), CurrencyManager).EndCurrentEdit() Call MyDataAccess.UpdateDataSet(MyDataset, MySqlDataAdapter, "Jobs") End If End Sub Friend Function GetDefaultComboValue(ByVal strQuery As String, ByVal strRequiredField As String) As Integer Call WriteDebug("frmJobs", "GetDefaultComboValue") Dim MyReader As SqlDataReader MyReader = MyDataAccess.CreateDataReader(strQuery, GblConnectionString2) If MyReader.HasRows Then While MyReader.Read IntDefaultValue = CType(DealWithNulls(MyReader(strRequiredField)), Integer) End While End If Return IntDefaultValue End Function Public Sub HandleCellButtonClick(ByVal sender As Object, ByVal e As DatagridColumns.DataGridButton.DataGridCellButtonClickEventArgs) Call WriteDebug("frmJobs", "HandleCellButtonClick") '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(Gridfunctions.htcolumnlist("JobStatus"), Integer) If UCase(CType(GblProjectGrid(IntRowNum, IntJobStatusCol), String)) <> "LIVE" Then MessageBox.Show("Job's with a status of 'Dead' or 'Delivered' cannot be activated", "Job Activate Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Sub End If IntJobKeyCol = CType(Gridfunctions.htcolumnlist("JobKey"), Integer) ProjectNameSpace.mdiClient.myJobControl.ActiveJob = CType(GblProjectGrid(IntRowNum, IntJobKeyCol), Integer) Dim MyCurrNode As JobSNode MyCurrNode = CType(mdiClient.ProjectExplorer.SelectedNode, JobSNode) Call mdiClient.RefreshProjectExplorer() Call mdiClient.SelectNode(CType(MyCurrNode.Parent, ProjectNode).Key.ToString, "JOBS", MyCurrNode.Key.ToString) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim Myform As Form Myform = New frmquotes Myform.ShowDialog() End Sub End Class End Namespace 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 InitializeComponent (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 Show quoteHide quote "Geraldine Hobley" <GeraldineHob***@discussions.microsoft.com> wrote in message news:F900F557-77F7-43C7-BA4D-E86DEEF2935A@microsoft.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.DotNetMagic.Controls.ToolControl > Public WithEvents btnCJobs As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Public WithEvents btnCQuotes As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Public WithEvents btnCOrders As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Public WithEvents btnCCalloffs As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Public WithEvents btnCInvoices As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Public WithEvents btnCProjectDet As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Protected cmnuGrid As Crownwood.DotNetMagic.Menus.PopupMenu > 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.DotNetMagic.Controls.ButtonWithStyle > Public WithEvents ProjectSiteAddress 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.DotNetMagic.Controls.ButtonWithStyle > Public WithEvents tlProjectItem As System.Windows.Forms.ToolTip > Public WithEvents OEProjectItem As > Crownwood.DotNetMagic.Controls.OfficeExtender > Friend WithEvents LblMarginMoney As System.Windows.Forms.Label > Friend WithEvents LblMarginPercent As System.Windows.Forms.Label > Public WithEvents ctbMargin As CurrencyTextBox.CurrencyTextBox > Public WithEvents PtxtMargin As Windows.Forms.TextBox > Friend WithEvents MenuControl1 As Crownwood.Magic.Menus.MenuControl > Me.dgProjectItem = New System.Windows.Forms.DataGrid > Me.tcProjectItem = New Crownwood.DotNetMagic.Controls.ToolControl > Me.btnCProjectDet = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.btnCJobs = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.btnCQuotes = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.btnCOrders = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.btnCCalloffs = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.btnCInvoices = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.ImgJobs = New System.Windows.Forms.ImageList(Me.components) > Me.gpProjectInfo = New System.Windows.Forms.GroupBox > Me.PtxtMargin = New System.Windows.Forms.TextBox > Me.ctbMargin = New CurrencyTextBox.CurrencyTextBox > Me.LblMarginMoney = New System.Windows.Forms.Label > Me.LblMarginPercent = New System.Windows.Forms.Label > Me.bwsSearch = New Crownwood.DotNetMagic.Controls.ButtonWithStyle > Me.ProjectSiteAddress = New System.Windows.Forms.TextBox > Me.lblAddress = New System.Windows.Forms.Label > Me.ProjectSiteName = New System.Windows.Forms.TextBox > Me.LblSiteName = New System.Windows.Forms.Label > Me.bwsView = New Crownwood.DotNetMagic.Controls.ButtonWithStyle > Me.tlProjectItem = New System.Windows.Forms.ToolTip(Me.components) > Me.OEProjectItem = New > Crownwood.DotNetMagic.Controls.OfficeExtender(Me.components) > Me.MenuControl1 = New Crownwood.Magic.Menus.MenuControl > CType(Me.dgProjectItem, > System.ComponentModel.ISupportInitialize).BeginInit() > CType(Me.tcProjectItem, > System.ComponentModel.ISupportInitialize).BeginInit() > 'dgProjectItem > > The code for the child form is as follows > > > Imports ProjectList.ProjectNameSpace.Gridfunctions.DataGrids > Imports DirectoryNode > Imports System.Data.SqlClient > > > Namespace ProjectNameSpace > Public Class frmJobs > Inherits ProjectItem_Form.ProjectItemForm > > #Region " Windows Form Designer generated code " > > Public Sub New() > MyBase.New() > > 'This call is required by the Windows Form Designer. > InitializeComponent() > > 'Add any initialization after the InitializeComponent() 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.Dispose() > End If > End If > MyBase.Dispose(disposing) > End Sub > > 'Required by the Windows Form Designer > Private components As System.ComponentModel.IContainer > > '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.DotNetMagic.Controls.ButtonWithStyle > Friend WithEvents cboJobsStatus As System.Windows.Forms.ComboBox > Friend WithEvents TCJob As > Crownwood.DotNetMagic.Controls.ToolControl > Friend WithEvents btnCCopyJob As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Friend WithEvents btnCQuoteNotes As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Friend WithEvents ToolControl1 As > Crownwood.DotNetMagic.Controls.ToolControl > Friend WithEvents btnCNewJob As > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Friend WithEvents LblJobStatus As System.Windows.Forms.Label > Friend WithEvents AxOleLayout1 As AxOLELAYOUTLib.AxOleLayout > <System.Diagnostics.DebuggerStepThrough()> Private Sub > InitializeComponent() > Dim resources As System.Resources.ResourceManager = New > System.Resources.ResourceManager(GetType(frmJobs)) > Me.bwsSetDefault = New > Crownwood.DotNetMagic.Controls.ButtonWithStyle > Me.cboJobsStatus = New System.Windows.Forms.ComboBox > Me.TCJob = New Crownwood.DotNetMagic.Controls.ToolControl > Me.btnCCopyJob = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.btnCQuoteNotes = New > Crownwood.DotNetMagic.Controls.Command.ButtonCommand > Me.ToolControl1 = New > Crownwood.DotNetMagic.Controls.ToolControl > Me.LblJobStatus = New System.Windows.Forms.Label > Me.AxOleLayout1 = New AxOLELAYOUTLib.AxOleLayout > Me.gpProjectInfo.SuspendLayout() > CType(Me.dgProjectItem, > System.ComponentModel.ISupportInitialize).BeginInit() > CType(Me.tcProjectItem, > System.ComponentModel.ISupportInitialize).BeginInit() > CType(Me.TCJob, > System.ComponentModel.ISupportInitialize).BeginInit() > CType(Me.ToolControl1, > System.ComponentModel.ISupportInitialize).BeginInit() > CType(Me.AxOleLayout1, > System.ComponentModel.ISupportInitialize).BeginInit() > Me.SuspendLayout() > ' > 'PtxtMargin > ' > Me.PtxtMargin.Name = "PtxtMargin" > Me.OEProjectItem.SetOffice2003BackColor(Me.PtxtMargin, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > ' > 'ctbMargin > ' > Me.ctbMargin.Name = "ctbMargin" > Me.OEProjectItem.SetOffice2003BackColor(Me.ctbMargin, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > ' > 'gpProjectInfo > ' > Me.gpProjectInfo.Name = "gpProjectInfo" > Me.OEProjectItem.SetOffice2003BackColor(Me.gpProjectInfo, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > ' > 'dgProjectItem > ' > Me.dgProjectItem.Anchor = > CType(((System.Windows.Forms.AnchorStyles.Top Or > System.Windows.Forms.AnchorStyles.Left) _ > Or System.Windows.Forms.AnchorStyles.Right), > System.Windows.Forms.AnchorStyles) > Me.dgProjectItem.Name = "dgProjectItem" > Me.OEProjectItem.SetOffice2003BackColor(Me.dgProjectItem, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > Me.dgProjectItem.Size = New System.Drawing.Size(648, 184) > ' > 'tcProjectItem > ' > Me.tcProjectItem.Name = "tcProjectItem" > Me.OEProjectItem.SetOffice2003BackColor(Me.tcProjectItem, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > ' > 'ProjectSiteName > ' > Me.ProjectSiteName.Name = "ProjectSiteName" > Me.OEProjectItem.SetOffice2003BackColor(Me.ProjectSiteName, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > ' > 'ProjectSiteAddress > ' > Me.ProjectSiteAddress.Name = "ProjectSiteAddress" > ' > 'bwsSetDefault > ' > Me.bwsSetDefault.BackColor = > System.Drawing.Color.FromArgb(CType(195, Byte), CType(218, Byte), > CType(249, > Byte)) > Me.bwsSetDefault.Location = New System.Drawing.Point(200, 128) > Me.bwsSetDefault.Name = "bwsSetDefault" > Me.OEProjectItem.SetOffice2003BackColor(Me.bwsSetDefault, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > Me.bwsSetDefault.Size = New System.Drawing.Size(60, 21) > Me.bwsSetDefault.TabIndex = 6 > Me.bwsSetDefault.Text = "Set &Default" > Me.bwsSetDefault.TextEdge = > Crownwood.DotNetMagic.Common.TextEdge.Left > ' > 'cboJobsStatus > ' > Me.cboJobsStatus.DropDownStyle = > System.Windows.Forms.ComboBoxStyle.DropDownList > Me.cboJobsStatus.Location = New System.Drawing.Point(88, 128) > Me.cboJobsStatus.Name = "cboJobsStatus" > Me.OEProjectItem.SetOffice2003BackColor(Me.cboJobsStatus, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > Me.cboJobsStatus.Size = New System.Drawing.Size(104, 21) > Me.cboJobsStatus.TabIndex = 5 > ' > 'TCJob > ' > Me.TCJob.Dock = System.Windows.Forms.DockStyle.Bottom > Me.TCJob.Location = New System.Drawing.Point(0, 552) > Me.TCJob.Name = "TCJob" > Me.OEProjectItem.SetOffice2003BackColor(Me.TCJob, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > Me.TCJob.Size = New System.Drawing.Size(860, 4) > Me.TCJob.TabIndex = 11 > ' > 'btnCCopyJob > ' > Me.btnCCopyJob.Image = > CType(resources.GetObject("btnCCopyJob.Image"), System.Drawing.Image) > Me.btnCCopyJob.Tag = Nothing > Me.btnCCopyJob.Text = "Copy Job" > ' > 'btnCQuoteNotes > ' > Me.btnCQuoteNotes.Image = > CType(resources.GetObject("btnCQuoteNotes.Image"), System.Drawing.Image) > Me.btnCQuoteNotes.Tag = Nothing > Me.btnCQuoteNotes.Text = "Quote Notes" > ' > 'ToolControl1 > ' > Me.ToolControl1.Dock = System.Windows.Forms.DockStyle.Bottom > Me.ToolControl1.Location = New System.Drawing.Point(0, 556) > Me.ToolControl1.Name = "ToolControl1" > Me.OEProjectItem.SetOffice2003BackColor(Me.ToolControl1, > Crownwood.DotNetMagic.Controls.Office2003Color.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 = "LblJobStatus" > Me.OEProjectItem.SetOffice2003BackColor(Me.LblJobStatus, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > Me.LblJobStatus.Size = New System.Drawing.Size(64, 16) > Me.LblJobStatus.TabIndex = 13 > Me.LblJobStatus.Text = "Job Status:" > Me.LblJobStatus.TextAlign = > System.Drawing.ContentAlignment.BottomLeft > ' > 'AxOleLayout1 > ' > Me.AxOleLayout1.Enabled = True > Me.AxOleLayout1.Location = New System.Drawing.Point(32, 368) > Me.AxOleLayout1.Name = "AxOleLayout1" > Me.AxOleLayout1.OcxState = > CType(resources.GetObject("AxOleLayout1.OcxState"), > System.Windows.Forms.AxHost.State) > Me.OEProjectItem.SetOffice2003BackColor(Me.AxOleLayout1, > Crownwood.DotNetMagic.Controls.Office2003Color.Disable) > Me.AxOleLayout1.Size = New System.Drawing.Size(264, 184) > Me.AxOleLayout1.TabIndex = 14 > ' > 'frmJobs > ' > Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) > Me.ClientSize = New System.Drawing.Size(798, 529) > Me.Controls.Add(Me.AxOleLayout1) > Me.Controls.Add(Me.LblJobStatus) > Me.Controls.Add(Me.TCJob) > Me.Controls.Add(Me.bwsSetDefault) > Me.Controls.Add(Me.cboJobsStatus) > Me.Controls.Add(Me.ToolControl1) > Me.Location = New System.Drawing.Point(0, 0) > Me.Name = "frmJobs" > Me.OEProjectItem.SetOffice2003BackColor(Me, > Crownwood.DotNetMagic.Controls.Office2003Color.Base) > Me.Controls.SetChildIndex(Me.ToolControl1, 0) > Me.Controls.SetChildIndex(Me.dgProjectItem, 0) > Me.Controls.SetChildIndex(Me.tcProjectItem, 0) > Me.Controls.SetChildIndex(Me.gpProjectInfo, 0) > Me.Controls.SetChildIndex(Me.cboJobsStatus, 0) > Me.Controls.SetChildIndex(Me.bwsSetDefault, 0) > Me.Controls.SetChildIndex(Me.TCJob, 0) > Me.Controls.SetChildIndex(Me.LblJobStatus, 0) > Me.Controls.SetChildIndex(Me.AxOleLayout1, 0) > Me.gpProjectInfo.ResumeLayout(False) > CType(Me.dgProjectItem, > System.ComponentModel.ISupportInitialize).EndInit() > CType(Me.tcProjectItem, > System.ComponentModel.ISupportInitialize).EndInit() > CType(Me.TCJob, > System.ComponentModel.ISupportInitialize).EndInit() > CType(Me.ToolControl1, > System.ComponentModel.ISupportInitialize).EndInit() > CType(Me.AxOleLayout1, > System.ComponentModel.ISupportInitialize).EndInit() > Me.ResumeLayout(False) > > End Sub > > #End Region > > Private MyCombofunctions As New ComboFunctions > Private MyDataAccess As New DataAccess.DataAccess > Private blnGridFormatted As Boolean > Private MyGridfunctions As New Gridfunctions > Private MyDataset As New DataSet > Private dsJobs As New DataSet > Private MyJobsNode As DirectoryNode.JobSNode > Private MySqlDataAdapter As SqlDataAdapter > Private IntDefaultValue As Integer > Friend Const CIntSelectAllJobs As Integer = 3 > Friend IntJobStatus As Integer > Friend MyProjectInfoTable As DataTable > Private blnContextMenu As Boolean = False > > Private Sub frmJobs_Load(ByVal sender As Object, ByVal e As > System.EventArgs) Handles MyBase.Load > Dim blnGridformatted As Boolean > Me.tcProjectItem.Commands.Remove(Me.btnCJobs) > Call SetupCombos() > MyGridFunctions.MydataGrid = dgProjectItem > blnGridformatted = MyGridFunctions.FormatDataGrid(Jobs, "Jobs", > MyDataset) > GblProjectGrid = Me.dgProjectItem > End Sub > > Public Sub LoadData(ByVal MyNode As JobSNode) > MyDataset = MyNode.DataSet > MyJobsNode = MyNode > Call LoadJobs(MyNode.ProjectKey, > CType(cboJobsStatus.SelectedValue, Integer)) > Dim MyParentNode As ProjectNode > MyParentNode = CType(MyNode.Parent, ProjectNode) > MyProjectInfoTable = MyParentNode.DataSet.Tables("ProjectInfo") > If MyDataset.Tables("Jobs").Rows.Count > 0 Then > Call SetLayout() > End If > Call BindProjectInfo(MyProjectInfoTable) > Call BindNonTextFields(MyProjectInfoTable) > End Sub > > Private Sub BindNonTextFields(ByRef MyDatatable As DataTable) > Call BindCurrencyField("Text", MyDatatable, "MarginMoney", > Me.ctbMargin) > End Sub > > Private Sub DataGrid_MouseUp(ByVal sender As System.Object, ByVal e > As System.Windows.Forms.MouseEventArgs) Handles dgProjectItem.MouseUp > > 'If right mouse button was clicked and released, display > context menu assigned to the DataGrid. > If e.Button = MouseButtons.Right Then > blnContextMenu = True > Call SetupContextMenu(cmnuGrid, "dgJobs", ImgJobs) > If gblShowMenu Then > cmnuGrid.TrackPopup(dgProjectItem.PointToScreen(New > Point(e.X, e.Y))) > End If > End If > > End Sub > Private Sub SetupCombos() > Dim strQuery As String > strQuery = "Exec spCmbJobStatus" > Call MyCombofunctions.SetComboDataset(strQuery, MyDataset, > "JobStatusList", GblConnectionString2) > 'use this dataset for the on form combo too > cboJobsStatus.DataSource = MyDataset.Tables!JobStatuslist > cboJobsStatus.DisplayMember = "JobStatus" > cboJobsStatus.ValueMember = "JobStatusKey" > strQuery = "Exec SPSelectDefaultJobStatus" > cboJobsStatus.SelectedValue = GetDefaultComboValue(strQuery, > "DefaultJobStatus") > > End Sub > > Private Sub LoadJobs(ByVal IntProjectkey As Integer, ByVal > IntJobStatus As Integer) > Dim strquery As String > If IntJobStatus = -1 Then > IntJobStatus = CIntSelectAllJobs '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.FillsqlAdapter(MyJobsNode.SQLQuery, dsJobs, > "Jobs", GblConnectionString2, MySqlDataAdapter) > Call MyGridfunctions.LoadProjectItemsGrid(MyDataset, > dgProjectItem, "Jobs") > Me.dgProjectItem.DataSource = MyDataset.Tables("Jobs") > Call DisableAddRowToGrid(dgProjectItem) > AddHandler MyDataset.Tables.Item("Jobs").RowDeleted, New > DataRowChangeEventHandler(AddressOf JobsCol_deleted) > > End Sub > > > > Private Sub JobsCol_deleted(ByVal sender As Object, ByVal e As > DataRowChangeEventArgs) > Call WriteDebug("frmProjectDetails", "JobsCol_deleted") > System.Windows.Forms.Cursor.Current = > System.Windows.Forms.Cursors.WaitCursor > DirectCast(BindingContext(MyDataset.Tables!Jobs), > CurrencyManager).EndCurrentEdit() > Dim objCommandBuilder As New > SqlCommandBuilder(MySqlDataAdapter) > 'RCTEST - remove the NOT in the IF below > If Not MyDataAccess.UpdateDataSet(MyDataset, MySqlDataAdapter, > "Jobs") Then > Call mdiClient.RefreshProjectExplorer() > Call mdiClient.SelectNode(CType(MyJobsNode.Parent, > ProjectNode).Key.ToString, "JOBS", MyJobsNode.Key.ToString) > End If > System.Windows.Forms.Cursor.Current = > System.Windows.Forms.Cursors.Default > End Sub > > 'Code: dgjobs_CurrentCellchanged > Private Sub dgProjectItem_CurrentCellChanged(ByVal sender As > System.Object, ByVal e As System.EventArgs) Handles > dgProjectItem.CurrentCellChanged > Call WriteDebug("frmJobs", "dgJobs_CurrentCellChanged") > Call SetLayout() > DirectCast(BindingContext(MyDataset.Tables.Item("Jobs")), > CurrencyManager).EndCurrentEdit() > Call MyDataAccess.UpdateDataSet(MyDataset, MySqlDataAdapter, > "Jobs") > 'Call MyTree.SetLayoutPic(dgJobs(dgJobs.CurrentCell.RowNumber, > IntJobdirCol)) > > End Sub > Private Sub SetLayout() > Dim IntJobDirCol As Integer > Dim IntRowNum As Integer = dgProjectItem.CurrentCell.RowNumber > IntJobDirCol = > CType(MyGridfunctions.htcolumnlist("JobDirectory"), Integer) > Call SetLayoutPic(CType(dgProjectItem(IntRowNum, IntJobDirCol), > String)) > End Sub > > Private Sub SetLayoutPic(ByVal 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(stJobLayoutFile) Then > Me.AxOleLayout1.FileName = stJobLayoutFile > Else > Me.AxOleLayout1.FileName = "" > End If > > End Sub > Private Sub dgProjectItem_Click(ByVal sender As System.Object, > ByVal > e As System.EventArgs) Handles dgProjectItem.Click > > Dim pt As Point = dgProjectItem.PointToClient(Cursor.Position) > Dim hti As DataGrid.HitTestInfo > hti = dgProjectItem.HitTest(pt) > If hti.Type = DataGrid.HitTestType.RowHeader Then > DirectCast(BindingContext(MyDataset.Tables.Item("Jobs")), > CurrencyManager).EndCurrentEdit() > Call MyDataAccess.UpdateDataSet(MyDataset, > MySqlDataAdapter, > "Jobs") > End If > > End Sub > > Friend Function GetDefaultComboValue(ByVal strQuery As String, > ByVal > strRequiredField As String) As Integer > Call WriteDebug("frmJobs", "GetDefaultComboValue") > > Dim MyReader As SqlDataReader > > MyReader = MyDataAccess.CreateDataReader(strQuery, > GblConnectionString2) > If MyReader.HasRows Then > While MyReader.Read > IntDefaultValue = > CType(DealWithNulls(MyReader(strRequiredField)), Integer) > End While > > End If > Return IntDefaultValue > > End Function > > > Public Sub HandleCellButtonClick(ByVal sender As Object, ByVal e As > DatagridColumns.DataGridButton.DataGridCellButtonClickEventArgs) > Call WriteDebug("frmJobs", "HandleCellButtonClick") > '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(Gridfunctions.htcolumnlist("JobStatus"), > Integer) > > If UCase(CType(GblProjectGrid(IntRowNum, IntJobStatusCol), > String)) <> "LIVE" Then > MessageBox.Show("Job's with a status of 'Dead' or > 'Delivered' cannot be activated", "Job Activate Error", > MessageBoxButtons.OK, > MessageBoxIcon.Error) > Exit Sub > End If > IntJobKeyCol = CType(Gridfunctions.htcolumnlist("JobKey"), > Integer) > ProjectNameSpace.mdiClient.myJobControl.ActiveJob = > CType(GblProjectGrid(IntRowNum, IntJobKeyCol), Integer) > Dim MyCurrNode As JobSNode > MyCurrNode = CType(mdiClient.ProjectExplorer.SelectedNode, > JobSNode) > Call mdiClient.RefreshProjectExplorer() > Call mdiClient.SelectNode(CType(MyCurrNode.Parent, > ProjectNode).Key.ToString, "JOBS", MyCurrNode.Key.ToString) > > End Sub > > Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As > System.EventArgs) > Dim Myform As Form > Myform = New frmquotes > Myform.ShowDialog() > End Sub > End Class > End Namespace
TextChanged
stringbuilder replace doesn't work on vbLf , vbCrLf , vbCr Regular Expression to Parse HTML Excel Reports in VB.NET Opening and Closing a form error : Cannot access a disposed object named "frmImage". Validate User Change/assign a value to dataset DATAGRID+SQL: INSERT - works, but SELECT - not :-( openfiledialog control locks folder Sending DTMF Tones |
|||||||||||||||||||||||