4 Replies - 1042 Views - Last Post: 11 June 2009 - 06:08 AM Rate Topic: -----

#1 katsikaniaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-June 09

Command Buttons and Editing file

Posted 09 June 2009 - 12:52 PM

I have to create a program so i can insert info about students and then save the info into a text file. Then i can delete the info of one student or all of them, edit the info of a student and also i can open the file and do all the previous actions. I must also create 4 command buttons (with names First, Last, Next and Previous) that will help me go to the first, last next or previous student. I have managed to accomplish most of the code but i dont know what to write about the 4 command buttons and the edit button.

I used command buttons for Insert, Load, Save, Delete, DeleteAll and Exit. so i need help with other 5 command buttons (First,Last,Next,Previous,Edit). Also i write the info of a student in 5 textboxes each for name, surname, year, id number, grade and then when i press Insert they show in a Listbox, and when i press Load they appear in the Listbox again.

Here is the code:

Option Explicit
Const max = 20
Dim p As Class1
Dim people(1 To max) As Class1

Private Sub Form_Load()

End Sub

Private Sub Text1_Click()
Text1.Text = ""
End Sub
Private Sub Text2_Click()
Text2.Text = ""
End Sub
Private Sub Text3_Click()
Text3.Text = ""
End Sub
Private Sub Text4_Click()
Text4.Text = ""
End Sub
Private Sub Text5_Click()
Text5.Text = ""
End Sub
Private Sub Insert_Click()
Set p = New Class1
p.studentname = Text1.Text
p.studentsurname = Text2.Text
p.studentyear = Text4.Text
p.studentidnumber = Text3.Text
p.studentgrade = Text5.Text
List1.AddItem p.show
Set people(List1.ListCount) = p
End Sub
Private Sub Load_Click()
Dim ff As Long
Dim line As String
ff = FreeFile
Open "data.txt" For Input As #ff
Do While Not EOF(ff)
Line Input #ff, line
If Len(line) Then List1.AddItem line
Loop
Close #ff
End Sub
Private Sub Delete_Click()
Dim index As Integer
index = List1.ListIndex
List1.RemoveItem index
End Sub
Private Sub Save_Click()
Dim i As Integer
Open "data.txt" For Output As #1
For i = 1 To List1.ListCount
Write #1, people(i).studentname, people(i).studentsurname, people(i).studentyear, people(i).studentidnumber, people(i).studentgrade
Next i
Close (1)
End Sub
Private Sub DeleteAll_Click()
Dim index As Integer
index = List1.ListIndex
List1.Clear
End Sub
Private Sub Exit_Click()
End
End Sub



Public studentname As String
Public studentidnumber As String
Public studentsurname As String
Public studentyear As String
Public studentgrade As String
Public Function show() As String
show = studentname & " - " & studentsurname & " - " & studentyear & " - " & studentidnumber & " - " & studentgrade
End Function



also i saw a post somewhere that said that VB6 is not used as much as it used to be, and is becoming a dead language. Also in my college they are going to start teaching Dotnet, does anypne know anything about this language?

This post has been edited by katsikaniaris: 09 June 2009 - 12:57 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Command Buttons and Editing file

#2 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: Command Buttons and Editing file

Posted 09 June 2009 - 10:21 PM

>Also in my college they are going to start teaching Dotnet, does anypne know anything about this language?

look to the left under programming help at VB.NET for a place to start...
Was This Post Helpful? 0
  • +
  • -

#3 katsikaniaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-June 09

Re: Command Buttons and Editing file

Posted 10 June 2009 - 10:49 AM

anyone can help witht the code??
Was This Post Helpful? 0
  • +
  • -

#4 Cookiesliyr  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 136
  • Joined: 16-May 09

Re: Command Buttons and Editing file

Posted 10 June 2009 - 01:41 PM

will i am not sure what kind do u wanna save ur info ... will u use class and save them in binary files ? or just text files by using structs or only the data of students , or maybe u will save them in Database ADO.net, will any way move the subject to net and make sure u know what type of data saving is it
Was This Post Helpful? 0
  • +
  • -

#5 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: Command Buttons and Editing file

Posted 11 June 2009 - 06:08 AM

>anyone can help witht the code??

>...code...

the four links at the bottom of this page...

http://msdn.microsof...c/aa700831.aspx


2k3 samples....

http://www.microsoft...;displaylang=en


Microsoft Visual Studio Learning Pack 2.0

http://www.microsoft...;displaylang=en


Visual Studio 2008 and .NET Framework 3.5 Training Kit

http://www.microsoft...;displaylang=en


.NET Framework 3.5 Enhancements Training Kit

http://www.microsoft...;displaylang=en


Visual Basic .NET Code Samples: Master Set of 101 Samples

http://www.microsoft...;displaylang=en


Visual Basic .NET Code Sample: Data Access - Data Entry Form

http://www.microsoft...;displaylang=en


Visual Basic .NET Code Sample: Creating a Windows Service

http://www.microsoft...;displaylang=en


Visual Basic .NET Code Sample: Create a Login Dialog Box

http://www.microsoft...;displaylang=en


ADO.NET and Visual Basic .NET

http://www.microsoft...;displaylang=en


Visual Basic .NET Code Samples: Master Set of 101 Samples

http://www.microsoft...;displaylang=en


Visual Basic .NET Code Sample: Automate Office

http://www.microsoft...;displaylang=en


Visual Basic .NET Code Sample: Use Stored Procedures

http://www.microsoft...;displaylang=en


Visual Studio 2010 and .NET Framework 4 Training Kit - May Preview

http://www.microsoft...;displaylang=en


SQL Server 2008 Developer Training Kit

http://www.microsoft...;displaylang=en


ASP.NET MVC Training Kit

http://www.microsoft...;displaylang=en


Microsoft .NET Framework SDK version 2.0 Samples Download (2k5)

http://www.microsoft...;displaylang=en


Visual C# 2008 Keybinding Reference Poster

http://www.microsoft...;displaylang=en


ASP.NET MVC 1.0

http://www.microsoft...;displaylang=en


Microsoft .NET Framework 3.5 Service Pack 1

http://www.microsoft...;displaylang=en


Microsoft® Silverlight™ 2 Tools for Visual Studio 2008 SP1

http://www.microsoft...;displaylang=en


Microsoft® Silverlight™ 2 Software Development Kit

http://www.microsoft...;displaylang=en


Microsoft® Silverlight™ 2 Tools for Visual Studio 2008 SP1

http://www.microsoft...;displaylang=en


Enterprise Library 4.1-October 2008

http://www.microsoft...;displaylang=en


Guidance Automation Extensions - February 2008 Release

http://www.microsoft...;displaylang=en


Guidance Automation Toolkit for Visual Studio 2008 - February 2008 Release

http://www.microsoft...;displaylang=en


Smart Client Software Factory – April 2008

http://www.microsoft...;displaylang=en


Web Service Software Factory: Modeling Edition - February 2008

http://www.microsoft...;displaylang=en


Web Client Software Factory - February 2008

http://www.microsoft...;displaylang=en


Hands-on Lab - Extending the Service Factory

http://www.codeplex....;ReleaseId=7847


Hands-on Lab - Building a Web Service

http://www.codeplex....;ReleaseId=7846


Web Service Software Factory: Modeling Edition Source Code - February 2008

http://www.microsoft...;displaylang=en


Guidance Automation Extensions for Visual Studio 2008 and Visual Studio 2008 Service Pack 1 Update (GAXP1409)

http://www.microsoft...;displaylang=en


WCF Security Guidance Package

http://www.codeplex....;ReleaseId=8814


Visual Studio Developer Center

http://msdn.microsof...io/default.aspx


Guidance Automation Extensions and Guidance Automation Toolkit

http://msdn.microsof...m/aa718948.aspx


Introduction to the Guidance Automation Toolkit

http://msdn.microsof...m/aa718950.aspx


Microsoft ASP.NET 2.0 AJAX Templates for Visual Studio 2008

http://www.microsoft...;displaylang=en


Hands-On Labs for Enterprise Library 4.1

http://www.microsoft...;displaylang=en


Hands-On Labs for the Unity Application Block 1.2

http://www.microsoft...;displaylang=en


Unity Application Block 1.2 Documentation for Visual Studio 2008

http://www.codeplex.com/unity

http://www.microsoft...;displaylang=en


Unity Application Block 1.2 - October 2008

http://www.microsoft...;displaylang=en


Composite Application Guidance for WPF and Silverlight - February 2009

http://www.microsoft...;displaylang=en


Hands On Labs - Validation Application Block (4.1) - December 2008

http://www.microsoft...;displaylang=en


Microsoft Axum

http://www.microsoft...;displaylang=en


Microsoft .NET Services White Papers (March 2009 CTP)

http://www.microsoft...;displaylang=en


Microsoft .NET Services SDK (March 2009 CTP)

http://www.microsoft...;displaylang=en


Windows Azure Tools for Microsoft Visual Studio May 2009 CTP

http://www.microsoft...;displaylang=en


Windows Azure Software Development Kit (May2009 CTP)

http://www.microsoft...;displaylang=en


URL Rewrite Module

http://www.iis.net/e...ions/URLRewrite


How to Download Windows PowerShell 1.0

http://www.microsoft...l/download.mspx


Microsoft Cloud Computing Tools

http://msdn.microsof...o/cc972640.aspx


Windows Azure

http://www.microsoft...efordevelopers/


Azure Services Platform

http://www.microsoft...re/default.mspx


Azure Services Platform

http://msdn.microsof...re/default.aspx


Azure Services Training Kit - April Update

http://www.microsoft...;displaylang=en


Live Framework Tools for Microsoft Visual Studio April 2009 CTP

http://www.microsoft...;displaylang=en


Live Framework SDK April 2009 CTP

http://www.microsoft...;displaylang=en


Live Framework Forum

http://social.msdn.m...mework/threads/


Live Framework Code Samples

http://code.msdn.mic...m/LiveFramework


Live Framework Overview

http://dev.live.com/liveframework/


101 Samples for Visual Basic 2005

http://msdn.microsof...c/ms789075.aspx

and so much more...


That should do you for about a year :-)

Good Luck
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1