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 3 2345
Could you post the code for your base class form and your inherited form?
"Geraldine Hobley" <Ge*************@discussions.microsoft.com> wrote in
message news:9F**********************************@microsof t.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.ButtonComma nd
Public WithEvents btnCQuotes As
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Public WithEvents btnCOrders As
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Public WithEvents btnCCalloffs As
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Public WithEvents btnCInvoices As
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Public WithEvents btnCProjectDet As
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
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.ButtonComma nd
Me.btnCJobs = New Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Me.btnCQuotes = New
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Me.btnCOrders = New
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Me.btnCCalloffs = New
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Me.btnCInvoices = New
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
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.c omponents)
Me.MenuControl1 = New Crownwood.Magic.Menus.MenuControl
CType(Me.dgProjectItem,
System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.tcProjectItem,
System.ComponentModel.ISupportInitialize).BeginIni t()
'dgProjectItem
The code for the child form is as follows
Imports ProjectList.ProjectNameSpace.Gridfunctions.DataGri ds
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.ButtonComma nd
Friend WithEvents btnCQuoteNotes As
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
Friend WithEvents ToolControl1 As
Crownwood.DotNetMagic.Controls.ToolControl
Friend WithEvents btnCNewJob As
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
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.ButtonComma nd
Me.btnCQuoteNotes = New
Crownwood.DotNetMagic.Controls.Command.ButtonComma nd
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).BeginIni t()
CType(Me.tcProjectItem,
System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.TCJob,
System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.ToolControl1,
System.ComponentModel.ISupportInitialize).BeginIni t()
CType(Me.AxOleLayout1,
System.ComponentModel.ISupportInitialize).BeginIni t()
Me.SuspendLayout()
'
'PtxtMargin
'
Me.PtxtMargin.Name = "PtxtMargin"
Me.OEProjectItem.SetOffice2003BackColor(Me.PtxtMar gin,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
'
'ctbMargin
'
Me.ctbMargin.Name = "ctbMargin"
Me.OEProjectItem.SetOffice2003BackColor(Me.ctbMarg in,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
'
'gpProjectInfo
'
Me.gpProjectInfo.Name = "gpProjectInfo"
Me.OEProjectItem.SetOffice2003BackColor(Me.gpProje ctInfo,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
'
'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.dgProje ctItem,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
Me.dgProjectItem.Size = New System.Drawing.Size(648, 184)
'
'tcProjectItem
'
Me.tcProjectItem.Name = "tcProjectItem"
Me.OEProjectItem.SetOffice2003BackColor(Me.tcProje ctItem,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
'
'ProjectSiteName
'
Me.ProjectSiteName.Name = "ProjectSiteName"
Me.OEProjectItem.SetOffice2003BackColor(Me.Project SiteName,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
'
'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.bwsSetD efault,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
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.cboJobs Status,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
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.Dis able)
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.ToolCon trol1,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
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.LblJobS tatus,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
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.AxOleLa yout1,
Crownwood.DotNetMagic.Controls.Office2003Color.Dis able)
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.Bas e)
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(Ne w
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("J obs")),
CurrencyManager).EndCurrentEdit()
Call MyDataAccess.UpdateDataSet(MyDataset, MySqlDataAdapter,
"Jobs")
'Call MyTree.SetLayoutPic(dgJobs(dgJobs.CurrentCell.RowN umber,
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("J obs")),
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.DataGridCellButtonC lickEventArgs)
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
"Geraldine Hobley" <Ge*************@discussions.microsoft.com> wrote in
message news:F9**********************************@microsof t.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.ButtonComma nd Public WithEvents btnCQuotes As Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Public WithEvents btnCOrders As Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Public WithEvents btnCCalloffs As Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Public WithEvents btnCInvoices As Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Public WithEvents btnCProjectDet As Crownwood.DotNetMagic.Controls.Command.ButtonComma nd 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.ButtonComma nd Me.btnCJobs = New Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Me.btnCQuotes = New Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Me.btnCOrders = New Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Me.btnCCalloffs = New Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Me.btnCInvoices = New Crownwood.DotNetMagic.Controls.Command.ButtonComma nd 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.c omponents) Me.MenuControl1 = New Crownwood.Magic.Menus.MenuControl CType(Me.dgProjectItem, System.ComponentModel.ISupportInitialize).BeginIni t() CType(Me.tcProjectItem, System.ComponentModel.ISupportInitialize).BeginIni t() 'dgProjectItem
The code for the child form is as follows
Imports ProjectList.ProjectNameSpace.Gridfunctions.DataGri ds 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.ButtonComma nd Friend WithEvents btnCQuoteNotes As Crownwood.DotNetMagic.Controls.Command.ButtonComma nd Friend WithEvents ToolControl1 As Crownwood.DotNetMagic.Controls.ToolControl Friend WithEvents btnCNewJob As Crownwood.DotNetMagic.Controls.Command.ButtonComma nd 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.ButtonComma nd Me.btnCQuoteNotes = New Crownwood.DotNetMagic.Controls.Command.ButtonComma nd 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).BeginIni t() CType(Me.tcProjectItem, System.ComponentModel.ISupportInitialize).BeginIni t() CType(Me.TCJob, System.ComponentModel.ISupportInitialize).BeginIni t() CType(Me.ToolControl1, System.ComponentModel.ISupportInitialize).BeginIni t() CType(Me.AxOleLayout1, System.ComponentModel.ISupportInitialize).BeginIni t() Me.SuspendLayout() ' 'PtxtMargin ' Me.PtxtMargin.Name = "PtxtMargin" Me.OEProjectItem.SetOffice2003BackColor(Me.PtxtMar gin, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) ' 'ctbMargin ' Me.ctbMargin.Name = "ctbMargin" Me.OEProjectItem.SetOffice2003BackColor(Me.ctbMarg in, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) ' 'gpProjectInfo ' Me.gpProjectInfo.Name = "gpProjectInfo" Me.OEProjectItem.SetOffice2003BackColor(Me.gpProje ctInfo, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) ' '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.dgProje ctItem, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) Me.dgProjectItem.Size = New System.Drawing.Size(648, 184) ' 'tcProjectItem ' Me.tcProjectItem.Name = "tcProjectItem" Me.OEProjectItem.SetOffice2003BackColor(Me.tcProje ctItem, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) ' 'ProjectSiteName ' Me.ProjectSiteName.Name = "ProjectSiteName" Me.OEProjectItem.SetOffice2003BackColor(Me.Project SiteName, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) ' '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.bwsSetD efault, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) 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.cboJobs Status, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) 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.Dis able) 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.ToolCon trol1, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) 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.LblJobS tatus, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) 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.AxOleLa yout1, Crownwood.DotNetMagic.Controls.Office2003Color.Dis able) 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.Bas e) 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(Ne w 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("J obs")), CurrencyManager).EndCurrentEdit() Call MyDataAccess.UpdateDataSet(MyDataset, MySqlDataAdapter, "Jobs") 'Call MyTree.SetLayoutPic(dgJobs(dgJobs.CurrentCell.RowN umber, 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("J obs")), 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.DataGridCellButtonC lickEventArgs) 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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. ...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
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...
| |