Home All Groups Group Topic Archive Search About

MS VB Newbie Tutorial

Author
9 Aug 2006 3:45 AM
Peter
Hi all,

I am trying to complete the tutorial on:
http://msdn.microsoft.com/vbasic/learning/newtodevelopment/choose/

I am up to this step:
# In the Form1_Load event handler, type the following code.

If My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Saturday Or _
  My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Sunday Then
  MsgBox("Happy Weekend!")
End If

# Press F5 to run your program.

However when I press F5, I get 2 build errors saying:
"Name 'My' is not declared."

How do I declare 'My'?

Can someone help me complete this tutorial?

Many thanks,

Peter.

Author
9 Aug 2006 4:36 AM
Cor Ligthert [MVP]
Peter,

Are you using VBNet 2005?

This is new for that

Cor

Show quoteHide quote
"Peter" <petethegai***@gmail.com> schreef in bericht
news:1155095155.811338.119290@75g2000cwc.googlegroups.com...
> Hi all,
>
> I am trying to complete the tutorial on:
> http://msdn.microsoft.com/vbasic/learning/newtodevelopment/choose/
>
> I am up to this step:
> # In the Form1_Load event handler, type the following code.
>
> If My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Saturday Or _
>  My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Sunday Then
>  MsgBox("Happy Weekend!")
> End If
>
> # Press F5 to run your program.
>
> However when I press F5, I get 2 build errors saying:
> "Name 'My' is not declared."
>
> How do I declare 'My'?
>
> Can someone help me complete this tutorial?
>
> Many thanks,
>
> Peter.
>
Author
9 Aug 2006 10:22 AM
Peter
Hi Cor,

Thanks for your response.

I am using VB .NET 2003.

Is there something different in this old version that must be causing
the problem?

Peter.

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> Peter,
>
> Are you using VBNet 2005?
>
> This is new for that
>
> Cor
>
> "Peter" <petethegai***@gmail.com> schreef in bericht
> news:1155095155.811338.119290@75g2000cwc.googlegroups.com...
> > Hi all,
> >
> > I am trying to complete the tutorial on:
> > http://msdn.microsoft.com/vbasic/learning/newtodevelopment/choose/
> >
> > I am up to this step:
> > # In the Form1_Load event handler, type the following code.
> >
> > If My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Saturday Or _
> >  My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Sunday Then
> >  MsgBox("Happy Weekend!")
> > End If
> >
> > # Press F5 to run your program.
> >
> > However when I press F5, I get 2 build errors saying:
> > "Name 'My' is not declared."
> >
> > How do I declare 'My'?
> >
> > Can someone help me complete this tutorial?
> >
> > Many thanks,
> >
> > Peter.
> >
Author
9 Aug 2006 10:43 AM
Cor Ligthert [MVP]
> Hi Cor,
>
> Thanks for your response.
>
> I am using VB .NET 2003.
>
> Is there something different in this old version that must be causing
> the problem?
>
Yes the "My" namespace is something new in VB 2005, AFAIK made with the
classic VB developpers in mind who had trouble with some of the OOP methods.

However there are some very handy things in it as by instance getting config
settings etc.

Cor

Show quoteHide quote
> Peter.
>
> Cor Ligthert [MVP] wrote:
>> Peter,
>>
>> Are you using VBNet 2005?
>>
>> This is new for that
>>
>> Cor
>>
>> "Peter" <petethegai***@gmail.com> schreef in bericht
>> news:1155095155.811338.119290@75g2000cwc.googlegroups.com...
>> > Hi all,
>> >
>> > I am trying to complete the tutorial on:
>> > http://msdn.microsoft.com/vbasic/learning/newtodevelopment/choose/
>> >
>> > I am up to this step:
>> > # In the Form1_Load event handler, type the following code.
>> >
>> > If My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Saturday Or _
>> >  My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Sunday Then
>> >  MsgBox("Happy Weekend!")
>> > End If
>> >
>> > # Press F5 to run your program.
>> >
>> > However when I press F5, I get 2 build errors saying:
>> > "Name 'My' is not declared."
>> >
>> > How do I declare 'My'?
>> >
>> > Can someone help me complete this tutorial?
>> >
>> > Many thanks,
>> >
>> > Peter.
>> >
>
Author
9 Aug 2006 10:53 AM
Peter
Any idea what the equivalent way to do it is in v2003?

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> > Hi Cor,
> >
> > Thanks for your response.
> >
> > I am using VB .NET 2003.
> >
> > Is there something different in this old version that must be causing
> > the problem?
> >
> Yes the "My" namespace is something new in VB 2005, AFAIK made with the
> classic VB developpers in mind who had trouble with some of the OOP methods.
>
> However there are some very handy things in it as by instance getting config
> settings etc.
>
> Cor
>
> > Peter.
> >
> > Cor Ligthert [MVP] wrote:
> >> Peter,
> >>
> >> Are you using VBNet 2005?
> >>
> >> This is new for that
> >>
> >> Cor
> >>
> >> "Peter" <petethegai***@gmail.com> schreef in bericht
> >> news:1155095155.811338.119290@75g2000cwc.googlegroups.com...
> >> > Hi all,
> >> >
> >> > I am trying to complete the tutorial on:
> >> > http://msdn.microsoft.com/vbasic/learning/newtodevelopment/choose/
> >> >
> >> > I am up to this step:
> >> > # In the Form1_Load event handler, type the following code.
> >> >
> >> > If My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Saturday Or _
> >> >  My.Computer.Clock.LocalTime.DayOfWeek = DayOfWeek.Sunday Then
> >> >  MsgBox("Happy Weekend!")
> >> > End If
> >> >
> >> > # Press F5 to run your program.
> >> >
> >> > However when I press F5, I get 2 build errors saying:
> >> > "Name 'My' is not declared."
> >> >
> >> > How do I declare 'My'?
> >> >
> >> > Can someone help me complete this tutorial?
> >> >
> >> > Many thanks,
> >> >
> >> > Peter.
> >> >
> >
Author
9 Aug 2006 11:29 AM
Cor Ligthert [MVP]
> Any idea what the equivalent way to do it is in v2003?
>
Something as this but than again for the weekend.
\\\
If Now.DayOfWeek = DayOfWeek.Wednesday Or _
          Now.DayOfWeek = DayOfWeek.Thursday Then
            MessageBox.Show("Happy middle of the week!")
End If
///

I hope this helps,

Cor
Author
9 Aug 2006 11:46 AM
Peter
Works perfectly!!!

Thanks so much for all your help.

Peter.

Cor Ligthert [MVP] wrote:
Show quoteHide quote
> > Any idea what the equivalent way to do it is in v2003?
> >
> Something as this but than again for the weekend.
> \\\
>  If Now.DayOfWeek = DayOfWeek.Wednesday Or _
>           Now.DayOfWeek = DayOfWeek.Thursday Then
>             MessageBox.Show("Happy middle of the week!")
>  End If
> ///
>
> I hope this helps,
>
> Cor
Author
9 Aug 2006 7:40 PM
rmacias
If you'd like, you can always download Visual Basic 2005 Express at:

http://msdn.microsoft.com/vstudio/express/vb/

It's designed for people new to development and hobbyist.  Best of all, it
is free.  That way, you can use the new features and keep in sync with your
tutorials.

Show quoteHide quote
"Peter" wrote:

> Works perfectly!!!
>
> Thanks so much for all your help.
>
> Peter.
>
> Cor Ligthert [MVP] wrote:
> > > Any idea what the equivalent way to do it is in v2003?
> > >
> > Something as this but than again for the weekend.
> > \\\
> >  If Now.DayOfWeek = DayOfWeek.Wednesday Or _
> >           Now.DayOfWeek = DayOfWeek.Thursday Then
> >             MessageBox.Show("Happy middle of the week!")
> >  End If
> > ///
> >
> > I hope this helps,
> >
> > Cor
>
>