Page 1 of 3 123 LastLast
Results 1 to 40 of 91

Thread: Where to start after being out of coding for 20 years!

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Where to start after being out of coding for 20 years!

    Guys, please help.
    I started programming in QBasic, then moved to VB6 but, for various reasons in life, I haven't coded in 23 years.
    I'm only starting again now and trying to learn VB.net
    The problem I have, I'm very out of practice. I forget nearly everything.
    Can you please tell me what the likes of Environment, OpenFile, Environment, GetFolderPath, CodeRule etc etc etc
    What are they actually called? I need to learn ALL of this but I'm not even sure what they're called? References? Syntax? Commands?
    Please help. Thanks

  2. #2
    Lively Member
    Join Date
    Dec 2024
    Location
    Livingston, Scotland
    Posts
    97

    Re: Where to start after being out of coding for 20 years!

    Hi
    I started with VB.NET so don't know anything of earlier VB environment.

    I'm an oldie and started from scratch after a long lay off where the only 'coding' I did was in Spreadsheets. So, what I can tell you is that it is not as daunting as you might think.

    Having said all that, my suggestion is that you jump in at the deep end, start a Project, make an error on the first line, come back to the forum and say 'I tried this but it's not working' - that is the common 'newbie' post, however, in my experience, you MUST include all information to enable someone to figure our a fix for you - such as the code that is causing the problem, the exception message you got if any, what result you got if any, what you expected the result to be etc etc etc

    Do you have a first Project in mind? If so give a brief description and I (or others) will assist to get you started.

  3. #3
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    12,039

    Re: Where to start after being out of coding for 20 years!

    I have a free lesson in my signature link that I created, www.vblessons.com, you can visit there. www.homeandlearn.co.uk is another useful resource.

    Most of the file stuff is located in the IO namespace, e.g. reading a text file is:
    Code:
    Dim contents As String = IO.File.ReadAllText("my-file.txt")
    If you have specific questions, this forum is definitely the place to ask.

    Edit - Another useful resource is ChatGPT. For example, I asked it to convert the code from here (link) and it gave me this:
    Code:
    Public Sub DrawPolygon(ByRef points() As Point) ' Accepts an array of System.Drawing.Point
        Dim s As Integer
        Dim point() As Point
    
        s = points.Length
        ReDim point(s - 1)
        point = CType(points, Point())
        ' Assuming "MemoryHDC" is a Graphics object and you want to use DrawPolygon
        Using graphics As Graphics = Graphics.FromHdc(MemoryHDC)
            graphics.DrawPolygon(Pens.Black, point)
        End Using
    End Sub
    Then I asked it to take a more .NET approach:
    Code:
    Imports System.Drawing
    
    Public Sub DrawPolygon(graphics As Graphics, points As Point())
        ' Validate input
        If graphics Is Nothing Then
            Throw New ArgumentNullException(NameOf(graphics), "Graphics object cannot be null.")
        End If
    
        If points Is Nothing OrElse points.Length < 3 Then
            Throw New ArgumentException("At least three points are required to draw a polygon.", NameOf(points))
        End If
    
        ' Draw the polygon
        graphics.DrawPolygon(Pens.Black, points)
    End Sub
    Certainly it's not intended to be one stop shop, but it is certainly useful if you have existing code.
    Last edited by dday9; Jan 24th, 2025 at 01:59 PM.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  4. #4
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,327

    Re: Where to start after being out of coding for 20 years!

    Google is your friend. When you have a question Google "Visual Basic how open a text file" or whatever the need. The is also a search function on this site.

  5. #5
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,890

    Re: Where to start after being out of coding for 20 years!

    Don't listen to them. Pick up a copy of TwinBasic and get started with a friendly coding environment that will refresh your QB/VB6 skills and prevent you making the worst mistake that a VB6-er can make, ie. going to VB.NOT.

    Just DON'T do it - you have been warned...
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,688

    Re: Where to start after being out of coding for 20 years!

    There is a significant contingent that has no desire to move forwards, as you can see from uncle B's response. That's somewhat an option, but not unless it is right for you. VB6 is still around, it's just terribly expensive to get a legal copy of it. Meanwhile VB.NET can be used for free. There are certainly differences between the languages, but nothing significant (other than the cost, which could be significant to some people). In the end, all languages end up producing machine byte code. Nobody writes in machine byte code, and very few write in Assembly, which is just machine byte code in a semi-readable format. Beyond that, all languages are ways to create usable sequences of machine byte codes in forms that is more readily understandable by humans. Some languages are best suited for certain niche areas, while others are more general. Everything else is just religion.

    VB.NET is a fine choice.
    My usual boring signature: Nothing

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    I really have no idea what you mean? Are you saying I should just revert to VB6? I want to make programmes compatible with Windows 10/11 and can give to family/friends.

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by dday9 View Post
    I have a free lesson in my signature link that I created, www.vblessons.com, you can visit there. www.homeandlearn.co.uk is another useful resource.

    Most of the file stuff is located in the IO namespace, e.g. reading a text file is:
    Code:
    Dim contents As String = IO.File.ReadAllText("my-file.txt")
    If you have specific questions, this forum is definitely the place to ask.

    Edit - Another useful resource is ChatGPT. For example, I asked it to convert the code from here (link) and it gave me this:
    Code:
    Public Sub DrawPolygon(ByRef points() As Point) ' Accepts an array of System.Drawing.Point
        Dim s As Integer
        Dim point() As Point
    
        s = points.Length
        ReDim point(s - 1)
        point = CType(points, Point())
        ' Assuming "MemoryHDC" is a Graphics object and you want to use DrawPolygon
        Using graphics As Graphics = Graphics.FromHdc(MemoryHDC)
            graphics.DrawPolygon(Pens.Black, point)
        End Using
    End Sub
    Then I asked it to take a more .NET approach:
    Code:
    Imports System.Drawing
    
    Public Sub DrawPolygon(graphics As Graphics, points As Point())
        ' Validate input
        If graphics Is Nothing Then
            Throw New ArgumentNullException(NameOf(graphics), "Graphics object cannot be null.")
        End If
    
        If points Is Nothing OrElse points.Length < 3 Then
            Throw New ArgumentException("At least three points are required to draw a polygon.", NameOf(points))
        End If
    
        ' Draw the polygon
        graphics.DrawPolygon(Pens.Black, points)
    End Sub
    Certainly it's not intended to be one stop shop, but it is certainly useful if you have existing code.
    I had a look at your lessons, they seem excellent. Would you not make video lessons of these?

    Also, for example, IO.File.ReadAllText - what is this actually called? These are what I need to learn. Are they syntax, commands? what are these built-in actually called?
    Thank you

  9. #9

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by FordPrefect View Post
    Hi
    I started with VB.NET so don't know anything of earlier VB environment.

    I'm an oldie and started from scratch after a long lay off where the only 'coding' I did was in Spreadsheets. So, what I can tell you is that it is not as daunting as you might think.

    Having said all that, my suggestion is that you jump in at the deep end, start a Project, make an error on the first line, come back to the forum and say 'I tried this but it's not working' - that is the common 'newbie' post, however, in my experience, you MUST include all information to enable someone to figure our a fix for you - such as the code that is causing the problem, the exception message you got if any, what result you got if any, what you expected the result to be etc etc etc

    Do you have a first Project in mind? If so give a brief description and I (or others) will assist to get you started.
    I normally worked with inputting data into text files. I made various little databases that were handy for me at the time. I really need go to back to scratch now though as I don't remember too much of it.

  10. #10
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    12,039

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by le007 View Post
    I had a look at your lessons, they seem excellent. Would you not make video lessons of these?
    Mais, I got a bit of an accent, me.

    Only (half) joking. I tried making a few videos, but I'm not very good in front of a camera.

    Quote Originally Posted by le007 View Post
    Also, for example, IO.File.ReadAllText - what is this actually called? These are what I need to learn. Are they syntax, commands? what are these built-in actually called?
    Thank you
    IO is the namespace. File is the class. ReadAllText is the method. Fully qualified, it's actually System.IO.File.ReadAllText, but System is imported by default.

    A namespace is basically a way to group together classes by using an identifier (e.g. name). You see people use namespaces when building libraries or proprietary code. At work we tend to use our company name as the namespace, e.g. OurSuperCoolCompany.OurSuperCoolClass.OurOkMethod.

    In this case, in order to use the File class, we have to reference the IO namespace. You can do this by either qualifying the class like I did in my example, e.g.
    Code:
    Public Module Module1
        Public Sub Main()
            Dim contents As String = IO.File.ReadAllText("somewhere.txt")
        End Sub
    End Module
    Or you could import the namespace so that you don't have to qualify it (i.e. fully type it out):
    Code:
    Imports IO
    Public Module Module1
        Public Sub Main()
            Dim contents As String = File.ReadAllText("somewhere.txt") ' notice the missing IO prefix because IO is imported at the top
        End Sub
    End Module
    A class represents an object and is the root of object-oriented programming (aka OOP). It is the place where you define code related to something. In this case that something is file operations. There are many other methods defined in the File class, I just showed you one example of calling the ReadAllText method. You can find the documentation for the class here: https://learn.microsoft.com/en-us/do...system.io.file. If you come from a VB6 background, VB6 was a quasi-OOP language. It mainly used modules, but there was the concept of a class. The issue was that classes in VB6 never truly adhered to OOP principles. If memory serves me correctly, more advanced concepts like inheritance and overriding weren't supported (or supported fully).

    A method is a block of code that gets executed. Technically, in VB.NET we have two types of methods: functions and sub routines (aka Subs). The difference between the two is that a function can return a value whereas a sub does not. If you have a VB6 background, this part should be very familiar. Under the hood, the ReadAllText method does the low-level code operations that call the Win32 API call to open the file, loop over the data, store the data in a String, and then return the String back to you. But since VB.NET is a high-level programming language, all we have to do is call a single line of code.
    Last edited by dday9; Jan 24th, 2025 at 10:38 PM.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  11. #11
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,108

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by dday9 View Post
    Mais, I got a bit of an accent, me.

    Only (half) joking. I tried making a few videos, but I'm not very good in front of a camera.
    I think DDay9 should make a few videos... wonder where that little Bug would appear
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  12. #12
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,712

    Re: Where to start after being out of coding for 20 years!

    A great place to start is taking time to read VB.NET documentation rather than attempting to code right off the bat.

    Microsoft has a learning series that can be very helpful. Note that the lessons are done with an older version of Visual Studio, which does not matter for learning.

    An alternative is to learn C#, which uses the same .NET Framework as VB.NET.

    Whether VB.NET or C#, learn how to separate frontend code from backend code by understanding classes (and modules for VB.NET).

  13. #13
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    812

    Re: Where to start after being out of coding for 20 years!

    Good way to learn any programming language is by doing and searching good is useful as someone said, also I suggest on a good book on VB.NET you can find many on amazon very cheap and some second-hand ones. if not, I found you a free one you can use to get you started again. Welcome to VBForums.

    https://books.goalkicker.com/VisualBasic_NETBook/

  14. #14
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,327

    Re: Where to start after being out of coding for 20 years!

    Mais, I got a bit of an accent, me.
    Then you should definitely make videos. Most VB tutorial video seem to be made by people originally from another country with strong accents.

    Never been to LA but have seen some live TV of interviews with Cajuns and some can be a real struggle to understand.

  15. #15

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by dday9 View Post
    Mais, I got a bit of an accent, me.

    Only (half) joking. I tried making a few videos, but I'm not very good in front of a camera.



    IO is the namespace. File is the class. ReadAllText is the method. Fully qualified, it's actually System.IO.File.ReadAllText, but System is imported by default.

    A namespace is basically a way to group together classes by using an identifier (e.g. name). You see people use namespaces when building libraries or proprietary code. At work we tend to use our company name as the namespace, e.g. OurSuperCoolCompany.OurSuperCoolClass.OurOkMethod.

    In this case, in order to use the File class, we have to reference the IO namespace. You can do this by either qualifying the class like I did in my example, e.g.
    Code:
    Public Module Module1
        Public Sub Main()
            Dim contents As String = IO.File.ReadAllText("somewhere.txt")
        End Sub
    End Module
    Or you could import the namespace so that you don't have to qualify it (i.e. fully type it out):
    Code:
    Imports IO
    Public Module Module1
        Public Sub Main()
            Dim contents As String = File.ReadAllText("somewhere.txt") ' notice the missing IO prefix because IO is imported at the top
        End Sub
    End Module
    A class represents an object and is the root of object-oriented programming (aka OOP). It is the place where you define code related to something. In this case that something is file operations. There are many other methods defined in the File class, I just showed you one example of calling the ReadAllText method. You can find the documentation for the class here: https://learn.microsoft.com/en-us/do...system.io.file. If you come from a VB6 background, VB6 was a quasi-OOP language. It mainly used modules, but there was the concept of a class. The issue was that classes in VB6 never truly adhered to OOP principles. If memory serves me correctly, more advanced concepts like inheritance and overriding weren't supported (or supported fully).

    A method is a block of code that gets executed. Technically, in VB.NET we have two types of methods: functions and sub routines (aka Subs). The difference between the two is that a function can return a value whereas a sub does not. If you have a VB6 background, this part should be very familiar. Under the hood, the ReadAllText method does the low-level code operations that call the Win32 API call to open the file, loop over the data, store the data in a String, and then return the String back to you. But since VB.NET is a high-level programming language, all we have to do is call a single line of code.
    I appreciate your help. I'm quite overwhelmed at the moment. I looked at old Qbasic files and VB6 files I worked on 20/30 years ago and I can't believe how much I actually knew and how much I don't know now.
    For example, I have no idea what these are even called now? Methods, is it?
    Console.WriteLine
    Application.Run
    Imports System.Drawing
    Imports System.Windows.Forms

    Also, methods, classes and subs - I have literally no idea what they are now. If you could please give me a brief description on the above, I'd be very grateful.

  16. #16

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by BenJones View Post
    Good way to learn any programming language is by doing and searching good is useful as someone said, also I suggest on a good book on VB.NET you can find many on amazon very cheap and some second-hand ones. if not, I found you a free one you can use to get you started again. Welcome to VBForums.

    https://books.goalkicker.com/VisualBasic_NETBook/
    That's extremely generous of you, thank you. I am still finding it difficult to actually grasp the very basics as I posted in the my above reply. The issue for me is that the books, examples etc all seem to overlook the basics that I'm looking for, EG:
    Where to learn the likes of and what they're actually even called in the first place.
    Console.WriteLine
    Application.Run
    Imports System.Drawing
    Imports System.Windows.Forms

  17. #17

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by kareninstructor View Post
    A great place to start is taking time to read VB.NET documentation rather than attempting to code right off the bat.

    Microsoft has a learning series that can be very helpful. Note that the lessons are done with an older version of Visual Studio, which does not matter for learning.

    An alternative is to learn C#, which uses the same .NET Framework as VB.NET.

    Whether VB.NET or C#, learn how to separate frontend code from backend code by understanding classes (and modules for VB.NET).
    Thank you very much. I actually did know VB6 very well - but to me at least, it appears as though .net is quite different. I'm trying to rejig my mind into what I knew from VB6 but finding it difficult at the moment. Hopefully it will come in time.

  18. #18
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,874

    Re: Where to start after being out of coding for 20 years!

    The best way to learn is to work through a quick online course, like that at www.homeandlearn.co.uk, then practice, practice, practice.
    You can find many examples or just plain definitions of code online, and you can get help here too.
    Starting from a VB6 background, you can skip a few chapters in the course I recommended…

  19. #19
    Lively Member
    Join Date
    Dec 2024
    Location
    Livingston, Scotland
    Posts
    97

    Re: Where to start after being out of coding for 20 years!

    Hi

    I am not a very good coder, but what I have learned was down to Googling/Forums. Tried videos/books but there was always something that just wouldn't work, incompatible versions etc.

    Ignore all below if not requiring example project.

    If useful, here is a short and very basic piece of code that doesn't do much, but tries to introduce some of the processes. If you want to try this out, here is how. There are comments in the code to assist.

    Start a new Project, name is unimportant. Should present the Designer on a new blank Form, default to name of 'Form1'. In the Designer, add a RichTextBox, a Label, 2 Buttons. Adjust the Properties of each to suit your taste (location, font. size etc) [if you need assist for that, just ask]. Double click on the Form title bar which should open the code page for Form1. Copy and replace all the code there with the code below. In the Toolbar, click on the project name button to run the application. The basic function of the app is to allow user to browse for and open/edit/save a plain text file. (if you are trying this, use a test text file)

    Code:
    ' Form1 with RichTextBox named 'RTB'
    ' Label1 for file Path display
    ' Button1 to Load file
    ' Button2 to Save file
    ' A test plain text file on HD
    
    ' These 3 Options are to help
    ' to minimize run time errors
    Option Strict On
    Option Explicit On
    Option Infer Off
    
    Public Class Form1
    
    	' create a path to save the text file too
    	' by left click on Label1 and browsing/selecting
    	' (can be defaulted to My Documents) but can be changed
    	Dim selectedFilePath As String '= My.Computer.FileSystem.SpecialDirectories.MyDocuments
    
    	' an array to store the incoming text
    	Dim loadedText() As String = Nothing
    
    	Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    		' set Label1 to current selectedFilePath
    		Label1.Text = selectedFilePath
    	End Sub
    
    	Function GetInputFilePath(startPath As String) As String
    
    		' create a new Dialog for User to choose file path
    		Dim fb As New OpenFileDialog
    
    		With fb
    			' set path to show initially
    			.InitialDirectory = startPath
    			' set file type(s) to show
    			.Filter = "Text Files|*.txt"
    		End With
    
    		If fb.ShowDialog = DialogResult.OK Then
    			Return fb.FileName
    		End If
    
    		Return String.Empty
    	End Function
    
    	Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    		' load the file from current
    		' selectedFilePath to loadedText
    		' and display in RTB 
    		loadedText = Nothing
    		If selectedFilePath IsNot (String.Empty) AndAlso IO.File.Exists(selectedFilePath) Then
    			loadedText = IO.File.ReadAllLines(selectedFilePath)
    		End If
    		RTB.Lines = loadedText
    	End Sub
    
    	Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    		' Save the text back to same file
    		If loadedText IsNot (String.Empty) Then
    			RTB.SaveFile(selectedFilePath, RichTextBoxStreamType.PlainText)
    		End If
    	End Sub
    
    	Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
    		' user choose file to open and copy path
    		' to selectedFilePath
    		selectedFilePath = GetInputFilePath(selectedFilePath)
    
    		' set Label1 to current selectedFilePath
    		If selectedFilePath IsNot (String.Empty) Then Label1.Text = selectedFilePath
    	End Sub
    
    End Class

  20. #20
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,937

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by le007 View Post
    Guys, please help.
    I started programming in QBasic, then moved to VB6 but, for various reasons in life, I haven't coded in 23 years.
    I'm only starting again now and trying to learn VB.net
    The problem I have, I'm very out of practice. I forget nearly everything.
    Can you please tell me what the likes of Environment, OpenFile, Environment, GetFolderPath, CodeRule etc etc etc
    What are they actually called? I need to learn ALL of this but I'm not even sure what they're called? References? Syntax? Commands?
    Please help. Thanks
    Start with a Physiatrist

    After thirty-eight years I'm ready for a break.
    Please remember next time...elections matter!

  21. #21
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,138

    Re: Where to start after being out of coding for 20 years!

    After thirty-eight years I'm ready for a break.
    Wait until you're been programming for 55 years........
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  22. #22

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by FordPrefect View Post
    Hi

    I am not a very good coder, but what I have learned was down to Googling/Forums. Tried videos/books but there was always something that just wouldn't work, incompatible versions etc.

    Ignore all below if not requiring example project.

    If useful, here is a short and very basic piece of code that doesn't do much, but tries to introduce some of the processes. If you want to try this out, here is how. There are comments in the code to assist.

    Start a new Project, name is unimportant. Should present the Designer on a new blank Form, default to name of 'Form1'. In the Designer, add a RichTextBox, a Label, 2 Buttons. Adjust the Properties of each to suit your taste (location, font. size etc) [if you need assist for that, just ask]. Double click on the Form title bar which should open the code page for Form1. Copy and replace all the code there with the code below. In the Toolbar, click on the project name button to run the application. The basic function of the app is to allow user to browse for and open/edit/save a plain text file. (if you are trying this, use a test text file)

    Code:
    ' Form1 with RichTextBox named 'RTB'
    ' Label1 for file Path display
    ' Button1 to Load file
    ' Button2 to Save file
    ' A test plain text file on HD
    
    ' These 3 Options are to help
    ' to minimize run time errors
    Option Strict On
    Option Explicit On
    Option Infer Off
    
    Public Class Form1
    
    	' create a path to save the text file too
    	' by left click on Label1 and browsing/selecting
    	' (can be defaulted to My Documents) but can be changed
    	Dim selectedFilePath As String '= My.Computer.FileSystem.SpecialDirectories.MyDocuments
    
    	' an array to store the incoming text
    	Dim loadedText() As String = Nothing
    
    	Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    		' set Label1 to current selectedFilePath
    		Label1.Text = selectedFilePath
    	End Sub
    
    	Function GetInputFilePath(startPath As String) As String
    
    		' create a new Dialog for User to choose file path
    		Dim fb As New OpenFileDialog
    
    		With fb
    			' set path to show initially
    			.InitialDirectory = startPath
    			' set file type(s) to show
    			.Filter = "Text Files|*.txt"
    		End With
    
    		If fb.ShowDialog = DialogResult.OK Then
    			Return fb.FileName
    		End If
    
    		Return String.Empty
    	End Function
    
    	Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    		' load the file from current
    		' selectedFilePath to loadedText
    		' and display in RTB 
    		loadedText = Nothing
    		If selectedFilePath IsNot (String.Empty) AndAlso IO.File.Exists(selectedFilePath) Then
    			loadedText = IO.File.ReadAllLines(selectedFilePath)
    		End If
    		RTB.Lines = loadedText
    	End Sub
    
    	Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    		' Save the text back to same file
    		If loadedText IsNot (String.Empty) Then
    			RTB.SaveFile(selectedFilePath, RichTextBoxStreamType.PlainText)
    		End If
    	End Sub
    
    	Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
    		' user choose file to open and copy path
    		' to selectedFilePath
    		selectedFilePath = GetInputFilePath(selectedFilePath)
    
    		' set Label1 to current selectedFilePath
    		If selectedFilePath IsNot (String.Empty) Then Label1.Text = selectedFilePath
    	End Sub
    
    End Class
    Thank you so much for this, I'm extremely grateful. I do know some of the basics and the more I'm reading, the more they're coming back.
    However, I still don't know what these are for, for example:
    Option Strict On
    Option Explicit On
    Option Infer Off

    And the likes of these - what are they actually called so that I can start to learn all of them. Are they called methods, classes etc?
    Console.WriteLine
    Application.Run
    Imports System.Drawing
    Imports System.Windows.Forms

    Thank you again.

  23. #23
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,874

    Re: Where to start after being out of coding for 20 years!

    Option Strict On - definition
    Option Explicit On - definition
    Option Infer Off - definition

  24. #24
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,874

    Re: Where to start after being out of coding for 20 years!


  25. #25
    Lively Member
    Join Date
    Dec 2024
    Location
    Livingston, Scotland
    Posts
    97

    Re: Where to start after being out of coding for 20 years!

    IGNORE AS ALREDY ANSWERED!

    Hi
    Here are links to a few of them. You need to use a search engine, it is your friend. I happen to use DuckDuckGo, I typed 'vb.net imports' then chose 'statement' from the drop down, then pasted the link here for you. Something you should learn quickly as it would help you a lot. Examples below:

    Option Strict

    Option Explicit

    Option Infer

    Imports

  26. #26
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,874

    Re: Where to start after being out of coding for 20 years!

    These links I found for you are easily found by googling. For example Google ‘MSDN vb.net Imports Statements’
    Usually the first or second result is what you’re looking for…

  27. #27
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,327

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by .paul. View Post
    These links I found for you are easily found by googling. For example Google ‘MSDN vb.net Imports Statements’
    Usually the first or second result is what you’re looking for…
    This has been suggested before. It's essential to learn how to use Google and MS documentation. It's much faster than depending on one of use to answer a question.

    One thing I don't think has been mentioned is using the IDE help system in VS.

    F1 is the Help hotkey. An easy way to use it is,

    Highlight what you need help with, like

    Option Strict On

    or

    Imports

    Then press the F1 key. It will take you to that subject in MS doc's.

  28. #28
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,937

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by 2kaud View Post
    Wait until you're been programming for 55 years........
    So, 55 years programming and you have been out for twenty-three making 78 years. Were computers around then?
    Please remember next time...elections matter!

  29. #29

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by .paul. View Post
    Option Strict On - definition
    Option Explicit On - definition
    Option Infer Off - definition
    Thank you, I'm not looking for literally everything to be explained, I'm really looking for to actually search for to start studying.
    I'm unsure what the above are actually called. Are they called 'methods'? That's all I'm after, really.

    The part where you start coding and VB starts suggesting a list of options.

  30. #30

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by FordPrefect View Post
    IGNORE AS ALREDY ANSWERED!

    Hi
    Here are links to a few of them. You need to use a search engine, it is your friend. I happen to use DuckDuckGo, I typed 'vb.net imports' then chose 'statement' from the drop down, then pasted the link here for you. Something you should learn quickly as it would help you a lot. Examples below:

    Option Strict

    Option Explicit

    Option Infer

    Imports
    Thanks, yeah I get you - absolutely. I'm just looking for what it's actually called that I need to learn. I mean, are these actually called 'methods' or what are they?
    The part where you start coding and VB starts suggesting a list of options.

  31. #31

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by .paul. View Post
    These links I found for you are easily found by googling. For example Google ‘MSDN vb.net Imports Statements’
    Usually the first or second result is what you’re looking for…
    yes, but it's not what I'm looking for. I'm trying to learn the 'methods', or whatever they're called.
    The part where you start coding and VB starts suggesting a list of options.
    I know a lot of syntax, I remember that part, it's the mouseover etc part I don't know and I'm trying to find out what they're called so I can study them.

  32. #32

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by wes4dbt View Post
    This has been suggested before. It's essential to learn how to use Google and MS documentation. It's much faster than depending on one of use to answer a question.

    One thing I don't think has been mentioned is using the IDE help system in VS.

    F1 is the Help hotkey. An easy way to use it is,

    Highlight what you need help with, like

    Option Strict On

    or

    Imports

    Then press the F1 key. It will take you to that subject in MS doc's.

    Thank you. As I said there, I know a lot of syntax, I remember that part, it's the mouseover etc part I don't know and I'm trying to find out what they're called so I can study them.

  33. #33
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,874

    Re: Where to start after being out of coding for 20 years!

    Option Strict On
    Option Explicit On
    Option Infer Off

    These are code editor settings. If you try the links i posted, there's an explanation for each of them

    Imports System.Drawing

    Imports are for qualifying library names. With System.Drawing imported, you can declare a new bitmap...

    Code:
    Dim img As New Bitmap(filename)
    Without System.Drawing imported, you need to use...

    Code:
    Dim img As New System.Drawing.Bitmap(filename)
    I'm not sure what you mean by the mouseover part. I'm guessing Intellisense.

  34. #34
    Lively Member
    Join Date
    Dec 2024
    Location
    Livingston, Scotland
    Posts
    97

    Re: Where to start after being out of coding for 20 years!

    Hi

    Try this link:

    Classes and Objects

    Again, a search provided that link and many others, just typing

    'vb.net classes methods'

  35. #35
    Frenzied Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,138

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by TysonLPrice View Post
    So, 55 years programming and you have been out for twenty-three making 78 years. Were computers around then?
    I started programming when I was 13 - and yes computers were around then. I still do some programming as a hobby although not for a living for a while. You're close for my age. You're only a few years over. I've been involved with computers for close to 60 years. All numbers are subject to rounding issues. I much preferred using the mini-computers from the 1970's and 1980's (DEC, HP, Wang, DG etc) than these modern computers. I was there at the birth/dawn of the age of the personal/hobbyist computer. But that era has gone - along with most of the young people writing code (Basic and assembler) for their own computer and then sharing it. The closest nowadays seems to be the pi.
    Ah the good old days....
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  36. #36
    Lively Member
    Join Date
    Dec 2024
    Location
    Livingston, Scotland
    Posts
    97

    Re: Where to start after being out of coding for 20 years!

    Hi

    Sharp ZX80, BBC Micro followed by several iterations stemming from BBC Micro, BBC Basic and Assembler, very basic code editor especially when using Assembly. Ending up with Acorn RISC machine(s) which were startling (the Basic interpreted programmes were at least as fast as any Assembler coded programmes on early PC's) Only hobbyist coding, but an excellent hobby.

  37. #37

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by FordPrefect View Post
    Hi

    Try this link:

    Classes and Objects

    Again, a search provided that link and many others, just typing

    'vb.net classes methods'
    Thanks, but I am still unsure of what the actual code is called that I'm trying to research. For example, the code options that pop up in the listbox if you type a character like F for file etc.

    Anyone know about this code. Why is the input before the for next - I'm just playing around with it but the for and next is occurring only after the input:
    Code:
    Imports System
    
    Public Module Module1
    	
    	dim numbe as integer
    	Dim name = Console.ReadLine()
    Dim currentDate = DateTime.Now
    	
    	Public Sub Main()
    		Console.WriteLine("Hello World")
    		for numbe = 1 to 10
    		console.writeline("Leo")
    	next
    	If numbe <10 then 
    		console.writeline("programme achieved")
    	end if
    	
    	
    	Console.Write("Please enter your name: ")
    
    Console.WriteLine($"Hello, {name}, on {currentDate:d} at {currentDate:t}")
    Console.Write("Press any key to continue...")
    Console.ReadKey(True)
    		
    	End Sub
    End Module

  38. #38
    Lively Member
    Join Date
    Dec 2024
    Location
    Livingston, Scotland
    Posts
    97

    Re: Where to start after being out of coding for 20 years!

    Hi

    First o all. That code will NOT assist your learning. Is that code something you found somewhere?

    Just guessing here: when you talk of 'pop up list' I am thinking that may be the intellisense that you are seeing. It is a little like autocomplete on a phone where it tries to pre-empt your input. This is a very helpful feature once you get used to it, but a little nonsensical at times until your input filters the list appropriately.

    Simple example: type Dim myString As String = "freddy"

    as you enter each character, observe the list becoming more appropriate - where necessary (it is only relevant for code key words etc. And, it will pick up on things like variable names, methods and functions to assist in autocompleting those.

  39. #39

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by FordPrefect View Post
    Hi

    First o all. That code will NOT assist your learning. Is that code something you found somewhere?

    Just guessing here: when you talk of 'pop up list' I am thinking that may be the intellisense that you are seeing. It is a little like autocomplete on a phone where it tries to pre-empt your input. This is a very helpful feature once you get used to it, but a little nonsensical at times until your input filters the list appropriately.

    Simple example: type Dim myString As String = "freddy"

    as you enter each character, observe the list becoming more appropriate - where necessary (it is only relevant for code key words etc. And, it will pick up on things like variable names, methods and functions to assist in autocompleting those.
    I actually mean the likes of this Application.InputBox or something that comes up when you type a command. I've included images to try and show you what I mean. I need to learn all those commands but I'm not sure what they're called. Maybe it's intellisense.

    Regarding the above code, it's my own creation, just piecing a few things together in a sandbox to try and get the feel for it a little.
    Attachment 194062Attachment 194063

  40. #40
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,874

    Re: Where to start after being out of coding for 20 years!

    Quote Originally Posted by le007 View Post
    … I've included images to try and show you what I mean.
    Attachment 194062Attachment 194063
    Your images aren’t uploaded properly. It’s a known fault on this site. The workaround is to click the Go Advanced button below and to the right of the post editor. That will take you to the advanced post editor where you can upload your images properly…

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width