Advanced VB.NET Programming - Threads, Events and Delegates (Part 1)

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ค. 2024
  • This is the first of two computer science lessons about threads, events and delegates. In these two lessons, you will learn how to create a multi-threaded racing game in Visual Basic.NET. The application makes use of the .NET Thread class, which allows you to build responsive applications that can run multiple sub programs at the same time. The game employs custom events to signal changes while the application is running, and delegates, otherwise known as type safe method pointers, to safely marshal method calls between threads. By following along and building this application yourself, you’ll come to see that threads, events and delegates are closely related. To get the most out of this video, you should already be familiar with the basics of high level programming. It would also be advantageous to have some familiarity with object oriented programming. You can find the essentials of object oriented programming with VB.NET in a separate series of computer science lessons. If you’re a C# programmer you still find these videos useful because, although there are some differences in language syntax, the fundamental concepts are the same.
    Chapters:
    00:00 Features of the game
    02:00 Animate a shape with a Graphics object
    05:04 Random movement
    07:45 Start multiple threads
    08:54 What is a thread?
    11:05 The ThreadStart Delegate
    14:49 Finishing touches

ความคิดเห็น • 18

  • @richardansonz
    @richardansonz ปีที่แล้ว +3

    You finally upload new video, My teacher~

  • @dford0001
    @dford0001 8 หลายเดือนก่อน

    Thank you for your time in putting together these videos. They have helped tremendously! I hope to see more!

  • @theview613
    @theview613 11 หลายเดือนก่อน +1

    Excellent tutorial from an excellent teacher.

  • @daveevans9809
    @daveevans9809 ปีที่แล้ว +2

    Excellent!

  • @Inyector
    @Inyector 8 หลายเดือนก่อน

    thanks for upload the video ,

  • @Itsjustleen
    @Itsjustleen ปีที่แล้ว +4

    First 😍

  • @westikle
    @westikle 10 หลายเดือนก่อน

    how do we start the two threads simultaneously? i find that whichever thread starts first always wins the race.

  • @anon_y_mousse
    @anon_y_mousse ปีที่แล้ว +1

    I don't know how many programmers still use VB, or Win32 for that matter, but this is a neat example. If you're doing C# next, any chance you could or would do it on Linux? I recently setup mono because a program I want to use was written in C#, but I'm thinking of translating it because I'd really like it to be more performant. However, it might be fun to play with it some, see if it has any features I want to copy to my own language that I haven't already done.

    • @theview613
      @theview613 11 หลายเดือนก่อน +1

      As hobbyist taught myself VB in 1991, and before that Basic using Microsoft Basic. Although there are many gaps in my knowledge, as far as desktop applications go, there is almost nothing it is not capable of. I also know C#, and Java, and am still learning, especially .NET, but prefer VB.

    • @anon_y_mousse
      @anon_y_mousse 11 หลายเดือนก่อน

      @@theview613 Do you also use Linux?

    • @theview613
      @theview613 11 หลายเดือนก่อน

      @@anon_y_mousse No! I understand VB is not useful in Linux.

    • @anon_y_mousse
      @anon_y_mousse 10 หลายเดือนก่อน

      @@theview613 Why would it not be? As long as there is a compiler for it, it should work. And it's not like you're limited to one language, you could learn more or you could do something really fun and implement a compiler for your language of choice.

  • @92JDaniel
    @92JDaniel 7 หลายเดือนก่อน

    Hello, in my code the "random" namespace does not exist, it gives an error BC30182: type not found. I use Visual Studio 2022, how can I solve this?

    • @ComputerScienceLessons
      @ComputerScienceLessons  7 หลายเดือนก่อน

      Check the project type you have used. Is it "Windows Forms App (.NET Framework)"? The "(.NET Framework)" part is important to ensure you have all the code libraries you need. :)KD