473,800 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web form inheritance help

I had a windows form project that had a functions module that could control
objects on the referenced main form. How would I do the same with a web
project using a web form? See my windows form example, and let me know what I
must do to get this to work on a web form.
Imports System.Data
Imports System.Data.Ole Db
Imports CrystalDecision s.CrystalReport s.Engine
Imports System.Windows. Forms

Module ProcessFunction s
Public loading As Boolean = True
Dim SQadapterTime As New SqlClient.SqlDa taAdapter
Dim SQadapterPhase As New SqlClient.SqlDa taAdapter
Dim SQadapterTask As New SqlClient.SqlDa taAdapter
Dim SQadapterActivi ty As New SqlClient.SqlDa taAdapter
Dim SQadapterCLient As New SqlClient.SqlDa taAdapter
Dim SQadapterMatter As New SqlClient.SqlDa taAdapter
Dim SQadApterGetTim e As New SqlClient.SqlDa taAdapter
Dim SQadApterGetPar ams As New SqlClient.SqlDa taAdapter
Dim SQLTime As New SqlClient.SqlCo mmand
Dim SQLPhase As New SqlClient.SqlCo mmand
Dim SQLTask As New SqlClient.SqlCo mmand
Dim SQLActivity As New SqlClient.SqlCo mmand
Dim SQLClient As New SqlClient.SqlCo mmand
Dim SQLMatter As New SqlClient.SqlCo mmand
Dim SQLGetime As New SQLClient.SqlCo mmand
Dim SQLGetParams As New SQLClient.SqlCo mmand
'Dim dreader As SqlClient.SqlDa taReader
Dim dtTime As New DataTable
Dim dtPhase As New DataTable
Dim dtTask As New DataTable
Dim dtActivity As New DataTable
Dim dtCLient As New DataTable
Dim dtMatter As New DataTable

Public Sub LoadAllFormData (ByVal MainF As FrmMain, ByVal DataLoadType As
Integer)

Dim objectDBConnect As New Exception("Unab le to connect to SQL
server Rc0101.")
Select Case DataLoadType
Case 1
SQLTime.Command Text = "SELECT Timekeeper, EmpName FROM
V_LiTimekeeper UNION SELECT 'L0', '-ALL-' FROM V_LiTimekeeper ORDER BY
EmpName"
SQLPhase.Comman dText = "SELECT PhaseCode, PhaseName,
PhaseCode + ' - ' + PhaseName AS PhaseComb FROM LitPhase order by phasename"
SQLTask.Command Text = "SELECT PhaseCode,TaskC ode, TaskName,
TaskCode + ' - ' + TaskName AS TaskComb FROM LitTask UNION SELECT
'9999','L0','-All-', '-ALL-' FROM Littask ORDER BY taskName"
SQLActivity.Com mandText = "SELECT activity_code,
activity_desc, activity_code + ' - ' + activity_desc AS ActDrp FROM
LitActivity UNION SELECT 'L0','-All-', '-ALL-' FROM Littask ORDER BY
activity_desc"
SQLClient.Comma ndText = "SELECT CLIENT_CODE, CLIENT_NAME,
CLIENT_NAME + ' - ' + CLIENT_CODE AS CLientDrp FROM LitClients ORDER BY
CLIENT_NAME"
SQLMatter.Comma ndText = "SELECT CLIENT_CODE, MATTER_CODE,
MATTER_NAME, MATTER_NAME + ' -' + MATTER_CODE AS MatterDrp FROM LitMatters
UNION SELECT '99','L0',' -ALL-',' -ALL-' FROM Littask ORDER BY MATTER_NAME"

SQLTime.Connect ion = LitDatabase
SQLPhase.Connec tion = LitDatabase
SQLTask.Connect ion = LitDatabase
SQLActivity.Con nection = LitDatabase
SQLClient.Conne ction = LitDatabase
SQLMatter.Conne ction = LitDatabase

SQadapterTime.S electCommand = SQLTime
SQadapterPhase. SelectCommand = SQLPhase
SQadapterTask.S electCommand = SQLTask
SQadapterActivi ty.SelectComman d = SQLActivity
SQadapterCLient .SelectCommand = SQLClient
SQadapterMatter .SelectCommand = SQLMatter
Try
' Load Timekeeper Dropdowns
SQadapterTime.F ill(dtTime).ToS tring()
MainF.DrpTimeke eper().DataSour ce = dtTime
MainF.DrpTimeke eper().DisplayM ember =
dtTime.Columns( 1).ToString
MainF.DrpTimeke eper().ValueMem ber =
dtTime.Columns( 0).ToString

' Load Phase Dropdowns
SQadapterPhase. Fill(dtPhase).T oString()
MainF.drpPhase( ).DataSource = dtPhase
MainF.drpPhase( ).DisplayMember =
dtPhase.Columns (2).ToString
MainF.drpPhase( ).ValueMember = dtPhase.Columns (0).ToString

' Load Task Dropdowns
SQadapterTask.F ill(dtTask).ToS tring()
dtTask.DefaultV iew.RowFilter = "PhaseCode = '" &
MainF.drpPhase( ).SelectedValue & "' OR TaskComb= '-All-'"
MainF.drpTask() .DataSource = dtTask
MainF.drpTask.S electedIndex = 0
MainF.drpTask.D isplayMember = dtTask.Columns( 3).ToString
MainF.drpTask.V alueMember = dtTask.Columns( 1).ToString

' Load Activity Dropdowns
SQadapterActivi ty.Fill(dtActiv ity).ToString()
MainF.drpActivi ty().DataSource = dtActivity
MainF.drpActivi ty().DisplayMem ber =
dtActivity.Colu mns(2).ToString
MainF.drpActivi ty().ValueMembe r =
dtActivity.Colu mns(0).ToString

' Load Client Dropdowns
SQadapterCLient .Fill(dtCLient) .ToString()
MainF.drpClient .DataSource = dtCLient
MainF.drpClient .DisplayMember =
dtCLient.Column s(2).ToString
MainF.drpClient .ValueMember = dtCLient.Column s(0).ToString

' Load Matter Dropdowns
SQadapterMatter .Fill(dtMatter) .ToString()
dtMatter.Defaul tView.RowFilter = "Client_Cod e = '" &
MainF.drpClient .SelectedValue & "' OR MatterDrp= ' -All-'"
MainF.drpMatter ().DataSource = dtMatter
MainF.drpMatter .SelectedIndex = 0
MainF.drpMatter .DisplayMember =
dtMatter.Column s(3).ToString
MainF.drpMatter .ValueMember = dtMatter.Column s(1).ToString
Catch objectDataFill As Exception
'Throw objectDBConnect

MsgBox(objectDa taFill.Message)
End Try

loading = False

MainF.RDActivit y.Checked = True

Case 2
If loading = False Then
dtTask.DefaultV iew.RowFilter = "PhaseCode = '" &
MainF.drpPhase( ).SelectedValue & "' OR TaskComb= '-All-'"
MainF.drpTask() .DataSource = dtTask
MainF.drpTask.S electedIndex = 0
MainF.drpTask.D isplayMember = dtTask.Columns( 3).ToString
MainF.drpTask.V alueMember = dtTask.Columns( 1).ToString

MainF.drpTask() .Enabled = True
End If
Case 3
If loading = False Then

dtMatter.Defaul tView.RowFilter = "Client_Cod e = '" &
MainF.drpClient .SelectedValue & "' OR MatterDrp= ' -All-'"
MainF.drpMatter ().DataSource = dtMatter
MainF.drpMatter .SelectedIndex = 0
MainF.drpMatter .DisplayMember =
dtMatter.Column s(3).ToString
MainF.drpMatter .ValueMember = dtMatter.Column s(1).ToString

MainF.drpMatter ().Enabled = True
End If
End Select
'
End Sub
Nov 18 '05 #1
3 1677
"Eric" <Er**@discussio ns.microsoft.co m> wrote in message
news:7A******** *************** ***********@mic rosoft.com...
I had a windows form project that had a functions module that could control objects on the referenced main form. How would I do the same with a web
project using a web form? See my windows form example, and let me know what I must do to get this to work on a web form.


First of all, the idea of having a module control things on a form is
questionable, at best. Surely the form is capable of managing itself? Unless
you've got more than one FrmMain form, it makes no sense at all for this
code to be separate from the form. The module would be used once, on a
single form, so why not make the form be the module?

I suggest that you take the data which was in the module and put it into the
web form as Private data. I suggest that you take the LoadAllFormData method
and also place it into the web form as a private method. Call that method in
Page_Load in the web form:

If Not Page.IsPostBack Then
LoadAllFormData ()
End If

--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #2
John, Thanks for not answering the question. I didnt ask if the form could
manage itself, did I ? without seeing the entire solution, how could you
arrive at the trite resolution with a simple " You shouldn't be doing this" ?
Answer the darn question, or don't reply at all. People like you waste
precious MSDN time, along with my own. Please STOP replying to problems with
more problems
"John Saunders" wrote:
"Eric" <Er**@discussio ns.microsoft.co m> wrote in message
news:7A******** *************** ***********@mic rosoft.com...
I had a windows form project that had a functions module that could

control
objects on the referenced main form. How would I do the same with a web
project using a web form? See my windows form example, and let me know

what I
must do to get this to work on a web form.


First of all, the idea of having a module control things on a form is
questionable, at best. Surely the form is capable of managing itself? Unless
you've got more than one FrmMain form, it makes no sense at all for this
code to be separate from the form. The module would be used once, on a
single form, so why not make the form be the module?

I suggest that you take the data which was in the module and put it into the
web form as Private data. I suggest that you take the LoadAllFormData method
and also place it into the web form as a private method. Call that method in
Page_Load in the web form:

If Not Page.IsPostBack Then
LoadAllFormData ()
End If

--
John Saunders
johnwsaundersii i at hotmail

Nov 18 '05 #3
"Eric" <Er**@discussio ns.microsoft.co m> wrote in message
news:53******** *************** ***********@mic rosoft.com...
John, Thanks for not answering the question. I didnt ask if the form could
manage itself, did I ? without seeing the entire solution, how could you
arrive at the trite resolution with a simple " You shouldn't be doing this" ?

Experience. :-)

1) The existence of a module is almost always a mistake due to an
over-literal translation of VB6 into VB.NET
2) The code in the module did nothing w hich the form could not do on its
own.
3) My guess that this used to be VB6 code suggested to me that there might
be only a single instance of FrmMain, in which case, I could think of no
reason for the code and data which are now in the module to not be in the
form instead.
4) It's a fairly serious violation of encapsulation to have the module
operate on the form. That's almost always a mistake.

Finally, if you're determined to make those mistakes, perhaps due to some
overriding reason which you did not share with us, then you should change
the accessibility of the properties and methods of the form to Public. They
will then be accessible by the module.
Answer the darn question, or don't reply at all. People like you waste
precious MSDN time, along with my own. Please STOP replying to problems with more problems
I'm still unclear on why it would cause a problem for you to simply move the
code. Is the module used with more than one form called FrmMain?
--
John Saunders
johnwsaundersii i at hotmail
"John Saunders" wrote:
"Eric" <Er**@discussio ns.microsoft.co m> wrote in message
news:7A******** *************** ***********@mic rosoft.com...
I had a windows form project that had a functions module that could

control
objects on the referenced main form. How would I do the same with a web project using a web form? See my windows form example, and let me know

what I
must do to get this to work on a web form.


First of all, the idea of having a module control things on a form is
questionable, at best. Surely the form is capable of managing itself? Unless you've got more than one FrmMain form, it makes no sense at all for this
code to be separate from the form. The module would be used once, on a
single form, so why not make the form be the module?

I suggest that you take the data which was in the module and put it into the web form as Private data. I suggest that you take the LoadAllFormData method and also place it into the web form as a private method. Call that method in Page_Load in the web form:

If Not Page.IsPostBack Then
LoadAllFormData ()
End If

--
John Saunders
johnwsaundersii i at hotmail

Nov 18 '05 #4

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

Similar topics

0
1176
by: Hemraj Julha | last post by:
Hi (Sorry if this appears twice but I posted this yersterday and I can't see it in the forum today) I'm trying "Visual Inheritance" in C# and facing an issue which might be related to my ignorance about namespaces and location of the source code within the folders so I'll try to explain my problem. I have a windows application called TestApp who's source is located under:
1
3210
by: Hemraj Julha | last post by:
Hi I'm trying "Visual Inheritance" in C# and facing an issue which might be related to my ignorance about namespaces and location of the source code within the folders so I'll try to explain my problem. I have a windows application called TestApp who's source is located under: d:\rajooDotNet\C#\TestApp
3
3371
by: Peter Cresswell | last post by:
Hi guys/gals, I'm using VS.net 2003 and having trouble with the following: I am trying to inherit a base class into a web form, but VS will then not allow me to add any ASP.NET controls using the designer. The base class does derive from System.Web.UI.Page. Here's a code snippet:
0
2231
by: Frnak McKenney | last post by:
I'm running into problems with VisualStudio.NET2003 and Windows Forms inheritance. It _feels_ like a bug, but it could just as well be a misunderstanding on my part regarding how the VS Designer handles inheritance. Environment: OS Name Microsoft Windows 2000 Professional Version 5.0.2195 Service Pack 4 Build 2195 Microsoft Visual C# .NET
4
2153
by: Jason Huang | last post by:
Hi, In my ASP.Net 1.1, C#, I have two windows forms, one is frmContactPerson, another is frmContactAddress. These two forms has many same Controls, except in one GroupBox they have different TextBoxes showing different data from datatable ContactPerson and ContactAddress respectively. Now come my question: How am I gonna apply the "Inheritance" concept in that situation? Any help will be appreciated.
11
2274
by: PAul Maskens | last post by:
The form designer adds unnecessary code to the section when using a subclassed control. I've reproduced this in VS.NET 2002 and VS.NET 2003 so it's pretty fundamental. Outline steps: Create a VB project. Create a subclass of a UI control, I used TextBox. Add no code to the subclass. Public Class Component1
13
1522
by: Just Me | last post by:
I have two forms. Each contains a property, say Prop. I do Public FormBeingUsed as Form .. .. .. Then I do FormBeingUsed= Form1 or maybe
4
304
by: Alan T | last post by:
How do I create a form inherited from an existing form in the same project ?
4
16269
by: Mikus Sleiners | last post by:
I can't seem to add new controls to form that is inherited from another form. I have BaseForm wich have table layout on it 2 panelsm and some buttons. Now i create InheritedForm : BaseForm and want to add some new controls and add them to pannels but i can't drag and drop them ... designer does not allow me. Why is that ? Panels and table layout modifiers is set to public.
18
25007
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin, that IE7 does not seem to offer any way to control the font size of a text input element.
0
9551
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
10275
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
10253
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,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7576
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
6811
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
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.