473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

problems with modules

Hi everyone

I've created a module (in a web app) to hold several generic functions as
subroutines. The problem I face is that I've got problems with the call of
system functions with wich I don't have problems if creating the same
function within the webform class.

as an example here follows a soubroutine within a module

Imports System.Web.UI

Public Class geralMdl

Shared Function LimparTexto(ByVal IdForm As String) As Boolean

Dim Form As Control = FindControl(IdForm)

If IsNothing(Form) Then

LimparTexto = False

Else

LimparTexto = True

Dim Control As Control

For Each Control In Form.Controls

If TypeOf Control Is WebControls.TextBox Then

CType(Control, WebControls.TextBox).Text = ""

End If

Next

Control = Nothing

End If

Form = Nothing

End Function

End Class

The function findControl is not recognized.....!!!! in the task list it says
that it's not declared....

Does anyone can help me with this?

thanks

JM
Jul 21 '05 #1
2 1443
Hi

FindControl is a function of the PagClass. As all ASPX
pages inherit from the Page Class, it would have worked
in ur web form properly. now if u are writin g a separate
Class for generic purposes, then wat u can do is

a) make the LimparTexto accept a parameter of page class
i.e. Shared Function LimparTexto(l_objPage as Page, ByVal
IdForm As String) As Boolean
b) Pass the Web Page(if LimparTexto function is called
from a web page then u can pass Me) as a parameter to the
LimparTexto function
c) Instead of
Dim Form As Control = FindControl(IdForm)
use
Dim Form As Control = l_objPage.FindControl(IdForm)

hth

regards,

sr
-----Original Message-----
Hi everyone

I've created a module (in a web app) to hold several generic functions assubroutines. The problem I face is that I've got problems with the call ofsystem functions with wich I don't have problems if creating the samefunction within the webform class.

as an example here follows a soubroutine within a module

Imports System.Web.UI

Public Class geralMdl

Shared Function LimparTexto(ByVal IdForm As String) As Boolean
Dim Form As Control = FindControl(IdForm)

If IsNothing(Form) Then

LimparTexto = False

Else

LimparTexto = True

Dim Control As Control

For Each Control In Form.Controls

If TypeOf Control Is WebControls.TextBox Then

CType(Control, WebControls.TextBox).Text = ""

End If

Next

Control = Nothing

End If

Form = Nothing

End Function

End Class

The function findControl is not recognized.....!!!! in the task list it saysthat it's not declared....

Does anyone can help me with this?

thanks

JM
.

Jul 21 '05 #2
It works in perfection.

Thanks SR

JM
"rs*****@yahoo.com" <an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl...
Hi

FindControl is a function of the PagClass. As all ASPX
pages inherit from the Page Class, it would have worked
in ur web form properly. now if u are writin g a separate
Class for generic purposes, then wat u can do is

a) make the LimparTexto accept a parameter of page class
i.e. Shared Function LimparTexto(l_objPage as Page, ByVal
IdForm As String) As Boolean
b) Pass the Web Page(if LimparTexto function is called
from a web page then u can pass Me) as a parameter to the
LimparTexto function
c) Instead of
Dim Form As Control = FindControl(IdForm)
use
Dim Form As Control = l_objPage.FindControl(IdForm)

hth

regards,

sr
-----Original Message-----
Hi everyone

I've created a module (in a web app) to hold several

generic functions as
subroutines. The problem I face is that I've got problems

with the call of
system functions with wich I don't have problems if

creating the same
function within the webform class.

as an example here follows a soubroutine within a module

Imports System.Web.UI

Public Class geralMdl

Shared Function LimparTexto(ByVal IdForm As String) As

Boolean

Dim Form As Control = FindControl(IdForm)

If IsNothing(Form) Then

LimparTexto = False

Else

LimparTexto = True

Dim Control As Control

For Each Control In Form.Controls

If TypeOf Control Is WebControls.TextBox Then

CType(Control, WebControls.TextBox).Text = ""

End If

Next

Control = Nothing

End If

Form = Nothing

End Function

End Class

The function findControl is not recognized.....!!!! in

the task list it says
that it's not declared....

Does anyone can help me with this?

thanks

JM
.

Jul 21 '05 #3

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

Similar topics

1
by: Jeremy Fincher | last post by:
I'm having problems compiling Python with socket support (and support for several other libraries) on Solaris 7. When I do the standard ./configure, make, make install dance, I got a fully...
2
by: Olaf Meyer | last post by:
I'm having some problems compiling Python 2.3.3 on HP-UX (B.11.00). I've tried sevral different options for the configure script (e.g. enabling/disabling gcc, aCC) but I always get the same problem...
3
by: Phil Frost | last post by:
Greetings all. I'm attempting to embed a python interpreter at a very low level in an OS I am writing. Currently I'm stuck with build issues. Firstly, as there is no working C compiler in our OS, I...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
3
by: Ryan Riehle | last post by:
Hi All! Trying to upgrade to Apache 2.0.49 and getting compile errors related to mod_auth_pgsql, any clue?: make: Entering directory `/usr/src/httpd-2.0.49'...
4
by: harleybl | last post by:
Hello, I have a C++ mixed mode dll ( unmanaged/managed ) that wraps a C# dll to provide some functionality for Microsoft Excel. I am able to compile my solution fine in Visual Studio .NET 2003...
1
by: Loading name... | last post by:
Hey I've got DNN Starter Kit (version 4.3.4) installed in my visual studio 2005. And are developing a DNN portal. Now I get this error where a module is suppose to be loaded: "Error: Adm is...
1
by: jmalone | last post by:
I have a python script that I need to freeze on AIX 5.1 (customer has AIX and does not want to install Python). The python script is pretty simple (the only things it imports are sys and socket)....
12
by: Janaka Perera | last post by:
Hi All, We have done a object oriented design for a system which will create a class multiply inherited by around 1000 small and medium sized classes. I would be greatful if you can help me...
3
by: KimberlyM | last post by:
This has been driving me crazy. I hope someone can help. The site displays perfectly in FF but all div's do not show in IE. Please help me find the problem! Thanks! Here is my css. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.