Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Class functions not showing

Reply
Thread Tools

Class functions not showing

 
 
David C
Guest
Posts: n/a
 
      10-02-2009
I created a new class in my App_Code folder and added a public function.
When I go to a code page on one of the web pages and I type in the
xxClass.Function I am not getting any intellisense that shows the function
name to pick from. Then if I spell out the whole name, e.g.
ValidateClass.GetPINno it tells me the function does not exist? What am I
missing? The same process works fine in another web application.
p.s. Using VS 2008 and .net 3.5

David


 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      10-02-2009
"David C" <(E-Mail Removed)> wrote in
news:O$(E-Mail Removed):

> I created a new class in my App_Code folder and added a public
> function. When I go to a code page on one of the web pages and I type
> in the xxClass.Function I am not getting any intellisense that shows
> the function name to pick from. Then if I spell out the whole name,
> e.g. ValidateClass.GetPINno it tells me the function does not exist?
> What am I missing? The same process works fine in another web
> application. p.s. Using VS 2008 and .net 3.5


Does it look like this:

public class xxClass
{
public void Function()
{
}
}

Public Class xxClass

Public Function MyFunction() as Something
End Function

End Class

or this

public class xxClass
{
public static void MyFunction()
{
}
}

Public Class xxClass

Public Shared Function MyFunction() as Something
End Function

End Class

If the former, you cannot declare like xxClass.MyFunction, as the items
require an instance. You can do this, however:

xxClass cls = new xxClass();
cls.MyFunction();

Dim cls As New xxClass()
cls.MyFunction()

the other possibility is you are not getting to the class period, as it
is not recognizing the namespace.

As a rule, I DO NOT use App_Code for anything. In general, people stick
application code there, and ASP.NET is a user interface, not an
application. If I have UI specific code, I will still create a library
named something like CompanyName.ProjectName.UI.{LibraryTypeNameHere}.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
 
David C
Guest
Posts: n/a
 
      10-02-2009

"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "David C" <(E-Mail Removed)> wrote in message
> news:O$(E-Mail Removed)...
>
>> What am I missing?

>
> Sounds like you've forgotten to declare the function as static...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net


Sorry Mark, I don't know what you mean. It looks exactly like others that
work fine.

David


 
Reply With Quote
 
David C
Guest
Posts: n/a
 
      10-02-2009

"Gregory A. Beamer" <(E-Mail Removed)> wrote in message
news:Xns9C989AFC57FE4gbworld@207.46.248.16...
> "David C" <(E-Mail Removed)> wrote in
> news:O$(E-Mail Removed):
>
>> I created a new class in my App_Code folder and added a public
>> function. When I go to a code page on one of the web pages and I type
>> in the xxClass.Function I am not getting any intellisense that shows
>> the function name to pick from. Then if I spell out the whole name,
>> e.g. ValidateClass.GetPINno it tells me the function does not exist?
>> What am I missing? The same process works fine in another web
>> application. p.s. Using VS 2008 and .net 3.5

>
> Does it look like this:
>
> public class xxClass
> {
> public void Function()
> {
> }
> }
>
> Public Class xxClass
>
> Public Function MyFunction() as Something
> End Function
>
> End Class
>
> or this
>
> public class xxClass
> {
> public static void MyFunction()
> {
> }
> }
>
> Public Class xxClass
>
> Public Shared Function MyFunction() as Something
> End Function
>
> End Class
>
> If the former, you cannot declare like xxClass.MyFunction, as the items
> require an instance. You can do this, however:
>
> xxClass cls = new xxClass();
> cls.MyFunction();
>
> Dim cls As New xxClass()
> cls.MyFunction()
>
> the other possibility is you are not getting to the class period, as it
> is not recognizing the namespace.
>
> As a rule, I DO NOT use App_Code for anything. In general, people stick
> application code there, and ASP.NET is a user interface, not an
> application. If I have UI specific code, I will still create a library
> named something like CompanyName.ProjectName.UI.{LibraryTypeNameHere}.
>
> Peace and Grace,
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> Twitter: @gbworld
> Blog: http://gregorybeamer.spaces.live.com
>
> *******************************************
> | Think outside the box! |
> *******************************************


Below is the Class so let me know what is wrong. Thanks.
David

Imports System.Data.SqlClient
Imports Microsoft.VisualBasic

Public Class GeneralClass
Public Function ValidPIN(ByVal intPIN As Integer, ByVal strEmployeeCode
As String) As Boolean
Dim bolValid As Boolean = False

Dim conData As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrin gs("MarsConnectionString").ConnectionString)
conData.Open()
Dim strSQL As String
'Get Stage targets and place in text boxes
strSQL = "SELECT TimePIN" & _
" FROM dbo.Employees" & _
" WHERE (EmployeeCode = '" & strEmployeeCode & "')"

Dim cmdSelect As SqlCommand = New SqlCommand(strSQL, conData)
Dim dtr As SqlDataReader = cmdSelect.ExecuteReader()
If dtr.HasRows Then
While dtr.Read()
If dtr("TimePIN") = intPIN Then
bolValid = True
End If
End While
End If
dtr.Close()
conData.Close()

End Function
End Class


 
Reply With Quote
 
David C
Guest
Posts: n/a
 
      10-02-2009

"Mark Rae [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "David C" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
>> Below is the Class so let me know what is wrong.

>
> 1) It's written in VB.NET... (ducks for cover)
>
> 2) Public Shared Function ValidPIN(....
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net


Thank you. So is it better practice to write the code, compile to DLL and
put in Bin folder or just use DAL? Thanks.

David


 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      10-05-2009
"Mark Rae [MVP]" <(E-Mail Removed)> wrote in news:uRb6W35QKHA.220
@TK2MSFTNGP02.phx.gbl:

> Me neither. It's just another example of the "training wheels" in Visual
> Studio.NET...


Like Microsoft.VisualBasic.Compatibility? <g>

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      10-05-2009
"David C" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> Thank you. So is it better practice to write the code, compile to DLL
> and put in Bin folder or just use DAL? Thanks.


From my perspective, start with a separate libraries for models and your
business classes (the application). You then add a Data Access layer to
persist the model to a data store and a UI to get user interaction.

The UI layer, whether ASP.NET, windows forms or Fred (assuming someone
makes a UI named Fred some day), is a thin layer on top of the app code. If
you write it any other way, you are doing it wrong, imo.

The next step is making sure you don't tightly couple these layers, but
that is a story for another day.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      10-05-2009
"Mark Rae [MVP]" <(E-Mail Removed)> wrote in news:eT$tG3cRKHA.1232
@TK2MSFTNGP05.phx.gbl:

>> Like Microsoft.VisualBasic.Compatibility? <g>

>
> Ugh! Don't get me started...
>


Too late.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sh Crypto isakmp sa is showing Active but Tunnel is showing line protocol down. urvin Cisco 0 04-15-2008 08:17 AM
ASP 1.1: DataGrid - Showing/Not Showing Buttons Ray Booysen ASP .Net 2 03-28-2006 02:49 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM
please help me in distinguish redefining functions, overloading functions and overriding functions. Xiangliang Meng C++ 1 06-21-2004 03:11 AM



Advertisments