Accessible Book

advertisement
Accessible Books Template
Submitted to the Faculty
Of
Electrical Engineering Department
University of Massachusetts Lowell
On
5/14/2012
By
Manoj Ravikumar
Akshay Dave
Approved by:
___________________
Instructor: Donn Rhine
Introduction .............................................................................................................. 3
Design Details .......................................................................................................... 5
Project Goal ........................................................................................................................................... 5
Project Outline ....................................................................................................................................... 5
Figure 1 – Accessible Books Block Diagram ...................................................................................................... 5
Design Parameters.................................................................................................... 6
WELCOME SCREEN ................................................................................................................................. 6
Figure 2 – Accessible Books Welcome Screen .................................................................................................... 6
CREATE BOOK .................................................................................................................................……7
Figure 3 – Accessible Books Create Book........................................................................................................... 7
EDIT BOOK ............................................................................................................................................... 7
Figure 4 – Accessible Books Edit Book ............................................................................................................. 8
READ BOOK ............................................................................................................................................. 8
Figure 5– Accessible Books Read Book ............................................................................................................. 9
Final Cost Analysis ................................................................................................ 10
Conclusion ............................................................................................................. 11
Appendix ................................................................................................................ 12
Figure 6 – Accessible Books Welcome Screen. ................................................................................................. 13
Figure 7 – Accessible Books Create Book......................................................................................................... 17
Figure 8 – Accessible Books Edit Book ............................................................................................................ 22
Figure 9 – Accessible Books Read Book ........................................................................................................... 21
2
Introduction
The Capstone project consists of designing a template for the Accessible Books for Shore
Educational Collaborative. Accessible Books are popular children’s books that have been recreated through
the use of scanning and recording to enable the non-reader to access them via technology. These books are
mainly intended for high interest/low reading level students with disabilities. The graphics and the text of a
selected book are displayed on the computer screen with narration added through either digitized (human
reader) or synthesized (computer speech) speech. These books with their rich graphic content and human
voice narration provide access to reading materials so children can read and re-read their favorite books
independently. These books are created with speech capabilities that enable switch and adapted access
methods.
There are numerous ways in creating the “Accessible Books Template”, using programs such as
Microsoft Powerpoint, Clicker 5, and Intellipex Studio. However we have came up with the most efficient
way in creating the Accessible Books Template, by using an complete programming language such as
Visual Basic. The template consists of three forms included as part of a core software prototype, which
includes the Welcome Screen, Create Book screen as well as the Library; the Welcome Screen allows the
user to easily navigate around the program from book creating to accessing the database library for the
Accessible Books.
Looking in depth at creating the Accessible Book within the “Create Book” form, the user gets to
select the template by preference, initiate the title and the author of the book and gets to select the subjects
as well as the grade level components. Once the components have been selected the user gets to edit the
book in Powerpoint and make further modifications, such as add text and pictures to slides. Once the book
has been created it will be manually saved in Powerpoint presentation, Powerpoint Show and an HTML
format. From here onwards the book is viewed within the Library interface where the user has the option to
search through titles by inputting the relevant text in the search bar or has the option to select the grade
level and the subject level criteria to narrow down the results. Once the list is populated the user gets to edit
the book to make further modifications or gets to play the book in Powerpoint show format. The user has
also connecting buttons located within the forms to switch between the different forms for convenience and
finally the preview window located in “Create Book” and “Library” forms is used to illustrate a quick
3
snippet of the book that’s been selected or a template that’s been created as part of the program. Thus,
making this software an easy to use, compatible and assistive to folks with reading disabilities.
Important information conveyed while creating the Accessible Books are the Copyrights
violations and the inclusion of photos. Copyright prevents us from altering the texts, but the texts can be
presented a different size or can be broken into couple of pages. The Accessible Books need to consist of
numerous stock photos pertaining to the novel and that reflects the child’s interests.
4
Design Details
Project Goal
The goal of this project was to build a complete software tool to assist any classroom
environment or learning centers, addressing reading proficiency needs.
Project Outline
Our project involved creating a software prototype template for Accessible Books. We
begin with the initial installer file that would install the software’s GUI and the Text-ToSpeech program that’s embedded in the prototype and the Accessible Books are then
created through the GUI by assigning the different fields then are directed into MS
Powerpoint. Once the book has been created it is stored in the server and is distributed
amoung the client PCs (See Figure 1).
Figure 1 – Accessible Books Block Diagram
5
Design Parameters
Welcome Screen
The accessible book initial GUI appears after the installer file has been installed.
This form includes the “Create Book”, “Edit Book” and “Read Book” functions. The user
gets to select between the three functionalities based on their choice to either create an
accessible book, edit a previously created accessible book, or to read a accessible book
that’s stored in the database. The exit button quit the program.
Figure 2 – Accessible Books Welcome Screen
Create Book
In the Create Book form the user gets to select a default template from the list of
default templates that’s pre-created and included in the software. The selected template
could be viewed in the template preview window. The user then inputs the book title
followed by the author’s name and selects a single grade level or multiple grade levels
6
followed by choosing a single subject or multiple subjects and hit the Go button. This
creates the accessible book in the database and opens the book in PowerPoint for further
modifications. Once the accessible book is modified using the standard PowerPoint
features the book is saved in PowerPoint presentation format, PowerPoint Show format
and PowerPoint HTML format. Saving the accessible book in three formats populates the
book in edit book and read book forms. The buttons that’s included to the bottom of the
page are the navigational buttons where the user can switch between the forms or return
to the main screen.
Figure 3 – Accessible Books Create Book
Edit Book
In the Accessible Books Edit book form. The user gets to select a book from the
database and makes modifications through PowerPoint. The user can narrow the search
results of the book by choosing a single or multiple grade levels, as well as selecting a
single or multiple subjects. The user could also search for a specific accessible book by
entering keywords such as the book’s title or the Author’s name. The user could use the
7
book preview window as a snippet to view the entire book before selecting the book.
After modifying the changes in PowerPoint, the user saves the book as PowerPoint
presentation, PowerPoint HTML and PowerPoint show. Saving it in these forms
populates the book into the Edit Book and Create Book forms.
Figure 4 – Accessible Books Edit Book
Read Book
In the Read Book form the user select a book from the database and play the book
directly in PowerPoint show format. The user can use the book preview window to see
the content of the book before initiating play. The books can also be sorted by grade
levels and subject area. To further narrowing down the search results key words such as
Author or the Book Title can be entered to display the search results. The navigation
buttons at the bottom of the program help switch between forms as well as return to the
main menu.
8
Figure 5 – Accessible Books Read Book
9
Final Cost Analysis
Activity
Part
Number Unit Price Total
Premier Assistive Text - Speech
1
10
$0.00
$0.00
TOTAL
$0.00
Conclusion
The final result of my project has fulfilled the original purpose. Though some
modifications were made in the interest of time and application such as creating the
database library and using it as an entirety for the prototype, the essence of the project
was maintained and was highly valuable. In the coming days the project will be
delivered to Shore Educational Collaborative to supplement their mission of educating
their students possessed with reading proficiency with this utility.
11
Appendix
Accessible Book
Welcome Screen
Public Class Form3 'Welcome Screen
Private Sub ExitButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ExitButton.Click
'Event generated by .NET Framework to respond to mouse click or enter key.
Me.Close()
End Sub
'Event generated by .NET Framework to switch into the appropriate form.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim oForm As New Form1 'hides current form and shows new form.
oForm.Show()
Me.Hide()
End Sub
'Event generated by .NET Framework to switch into the appropriate form.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Dim oForm As New Form2 'hides current form and shows new form.
oForm.Show()
Me.Hide()
End Sub
End Class
12
Figure 6 – Accessible Books Welcome Screen
Create Book
Imports Microsoft.Office.Interop 'add the Microsoft Office Library
Imports System.Data
Imports System.Windows.Forms 'add the Windows System Form
Public Class Form2 'AccessibleBooksTemplate
Dim conn As New SqlClient.SqlConnection 'Make the sequel connection to the SQL Database
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Dim files() As String
Dim path As String = AppDomain.CurrentDomain.BaseDirectory + "Templates" 'Retreives file from the
Templates folder
files = System.IO.Directory.GetFiles(path, "*.PPTX")
Dim fileName As String
Dim Author As String
For Each file As String In files
fileName = file.Substring(InStrRev(file, "\")) 'input the file name as string
fileName = fileName.Remove(fileName.Length - 5, 5)
Author = file.Substring(InStrRev(file, "\")) 'inputs the author's name as string
Author = Author.Remove(fileName.Length - 5, 5)
lstTemplates.Items.Add(fileName) 'adds file to the SQL database
Next
13
ConnectToSql() 'Makes connection to SQL
PopulateGrade() 'Populates Grade combo box
PopulateSubject() 'Populated Subject combo box
End Sub
Private Sub lstTemplates_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lstTemplates.SelectedIndexChanged
Dim fileName As String = lstTemplates.SelectedItem.ToString()
fileName = AppDomain.CurrentDomain.BaseDirectory + "Templates\" + fileName + ".htm" 'displays the
ppt file in layout window as HTML file
WebBrowser1.Navigate(fileName, False) 'creates the browser screen in the layout window
End Sub
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
e.Cancel = True 'creates the web browser in new window
End Sub
Private Sub CreateBook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
CreateBook.Click
'Dim - declares and allocates temporary storage space for a variable
'As - the data type
Dim MyApplication As PowerPoint.Application
Dim MyPresentation As PowerPoint.Presentation
Dim MySlide As PowerPoint.Slide
Dim MyAssistantOn As Boolean
Dim bookID As Integer
'Inserts Title of the Book and Author's name into the SQL database
Dim sqlString As String = "INSERT INTO BookMaster(Title, Author, FileName) VALUES('" &
BookTitle1.Text & "','" & AuthorTitle1.Text & "', '" & BookTitle1.Text & ".PPTX')"
'Makes the string connection to SQL database
Dim command As New SqlClient.SqlCommand(sqlString, conn)
Try
If IsDuplicateTitle() Then
MessageBox.Show("Error! Duplicate title, please choose a different title.") 'Validates for duplicate
titles in database.
Exit Sub
End If
command.ExecuteNonQuery()
command.CommandText = "Select Max(BookID) From BookMaster" 'Initiates random BookID in
database, one per book.
bookID = CType(command.ExecuteScalar(), Integer)
For Each item As ListViewItem In lsvSubject.CheckedItems 'Populates subjects in check items box
14
command.CommandText = "INSERT INTO BookSubject(BookID, Subject) VALUES(" &
bookID.ToString() & ",'" & item.Text & "')"
command.ExecuteNonQuery()
Next
For Each item As ListViewItem In lsvGradeLevel.CheckedItems 'Populates grades in check items box
command.CommandText = "INSERT INTO BookGrade(BookID, GradeLevel) VALUES(" &
bookID.ToString() & ",'" & item.Text & "')"
command.ExecuteNonQuery()
Next
Catch ex As Exception
MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records") 'Prevents
duplication of books in database
End Try
MyApplication = New PowerPoint.Application()
MyApplication.Visible = True
MyApplication.WindowState = PowerPoint.PpWindowState.ppWindowMaximized 'shows form in full
screen mode
Dim templateName As String = lstTemplates.SelectedItem.ToString()
templateName = AppDomain.CurrentDomain.BaseDirectory + "Templates\" + templateName + ".PPTX"
'templates listed in list box derieved from templates folder
Dim fileName As String = AppDomain.CurrentDomain.BaseDirectory + "Powerpoint\" + BookTitle1.Text
& ".PPTX"
Dim filename1 As String = AppDomain.CurrentDomain.BaseDirectory + "Powerpoint\" + BookTitle1.Text
& ".htm"
FileSystem.FileCopy(templateName, fileName) 'copies the book title that's inputted in GUI to Powerpoint
Presentation
MyPresentation = MyApplication.Presentations.Open(fileName, , , True)
MyPresentation.SaveAs(filename1, PowerPoint.PpSaveAsFileType.ppSaveAsHTML) 'auto save the
template as HTML file
''MyPresentation.SaveAs(filename1, PowerPoint.PpSaveAsFileType.ppSaveAsPresentation)
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ExitButton.Click
Dim oForm As New Form3
oForm.Show()
Me.Hide()
End Sub
Private Sub ConnectToSql()
'made conection to SQL server
conn.ConnectionString = "integrated security=SSPI;data source=(local)\SQLEXPRESS;" & _
15
"persist security info=False;database=Library"
Try
conn.Open()
' outputs dialog box during connection failure
Catch ex As Exception
MessageBox.Show("Failed to connect to data source")
End Try
End Sub
Private Function IsDuplicateTitle() As Boolean 'doesn't illustrate a duplicate title
Dim sqlString = "Select Title From BookMaster Where Upper(Title) = '" & BookTitle1.Text.ToUpper() &
"'"
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString, conn)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(command) 'makes a new
connection via adapter
Dim bookMaster As DataTable = New DataTable
adapter.Fill(bookMaster)
If bookMaster.Rows.Count > 0 Then 'Verify's the database for duplicate titles
IsDuplicateTitle = True
Else
IsDuplicateTitle = False
End If
End Function
Private Sub PopulateGrade()
Dim sqlString = "Select Grade From GradeMaster" 'populates grades from the database
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString, conn)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(command)
Dim gradeMaster As DataTable = New DataTable 'Fills in grade box from values from database
adapter.Fill(gradeMaster)
For Each row As DataRow In gradeMaster.Rows
lsvGradeLevel.Items.Add(row("Grade"))
Next
End Sub
Private Sub PopulateSubject()
Dim sqlString = "Select Subject From SubjectMaster" 'populates subjects from the database
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString, conn)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(command)
Dim subjectMaster As DataTable = New DataTable 'fills in data table from the subjects listed within
database
adapter.Fill(subjectMaster)
For Each row As DataRow In subjectMaster.Rows
lsvSubject.Items.Add(row("Subject"))
Next
16
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
Dim oForm As New Form1 'choose between different form, dims, current form, illustrates new form
oForm.Show()
Me.Hide()
End Sub
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles
WebBrowser1.DocumentCompleted
End Sub
End Class
Figure 7 – Accessible Books Create Book
Edit Book
Imports Microsoft.Office.Interop 'add t he Microsoft Office Library
Imports System.Data
Imports System.Windows.Forms
Public Class Form1 'Library
Dim conn As New SqlClient.SqlConnection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
ConnectToSql() 'Sequel string connection
17
Dim sqlString As String = "Select Title From BookMaster" 'Selects the books created within database by
Book Title.
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString, conn)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(command)
Dim titleMaster As DataTable = New DataTable 'Populated datatable from the entries within the database.
adapter.Fill(titleMaster)
lstTemplates.Items.Clear()
For Each row As DataRow In titleMaster.Rows
lstTemplates.Items.Add(row("Title"))
Next
PopulateGrade() 'Populates the grades custom box
PopulateSubject() 'Populates the subjects custom box
End Sub
Private Sub lstTemplates_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lstTemplates.SelectedIndexChanged
Dim fileName As String = lstTemplates.SelectedItem.ToString()
fileName = AppDomain.CurrentDomain.BaseDirectory + "PowerPoint\" + fileName + ".htm" 'Retrieves the
html layout of the book entries from the Powerpoint Folder.
WebBrowser1.Navigate(fileName, False)
End Sub
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
e.Cancel = True
End Sub
Private Sub EditBook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
EditBook.Click
'Dim - declares and allocates temporary storage space for a variable
'As - the data type that
Dim MyApplication As PowerPoint.Application
Dim MyPresentation As PowerPoint.Presentation
Dim MySlide As PowerPoint.Slide
Dim MyAssistantOn As Boolean
MyApplication = New PowerPoint.Application()
MyApplication.Visible = True
MyApplication.WindowState = PowerPoint.PpWindowState.ppWindowMaximized 'Maximizes the form to
full screen mode
Dim fileName As String = lstTemplates.SelectedItem.ToString()
fileName = AppDomain.CurrentDomain.BaseDirectory + "PowerPoint\" + fileName + ".PPTX" 'Chooses
the selected book from the Powerpoint folder by the Book Title name
18
MyPresentation = MyApplication.Presentations.Open(fileName, , , True) 'Presents the book in Powerpoint
show format
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ExitButton.Click
Dim oForm As New Form3 'Dims current form and opens the new form
oForm.Show()
Me.Hide()
End Sub
Private Sub ConnectToSql()
'Modifies the connection string
conn.ConnectionString = "integrated security=SSPI;data source=(local)\SQLEXPRESS;" & _
"persist security info=False;database=Library"
Try
conn.Open()
' Attempts to connect the SQL server
Catch ex As Exception
MessageBox.Show("Failed to connect to data source")
End Try
End Sub
Private Sub PopulateGrade() 'Populates the grade levels in combo box from database entry
Dim sqlString As String = "Select Distinct(GradeLevel) From BookGrade"
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString, conn)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(command)
Dim gradeMaster As DataTable = New DataTable
adapter.Fill(gradeMaster) 'Fills the grade combo box with grade level values
For Each row As DataRow In gradeMaster.Rows
lsvGradeLevel.Items.Add(row("GradeLevel")) 'Adds grade level values pertaining to the Book that was
created in Create Book form.
Next
End Sub
Private Sub PopulateSubject() 'Populates the subject levels in combo box from database entry
Dim sqlString As String = "Select Distinct(Subject) From BookSubject"
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString, conn)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(command)
Dim subjectMaster As DataTable = New DataTable
adapter.Fill(subjectMaster)
19
For Each row As DataRow In subjectMaster.Rows
lsvSubject.Items.Add(row("Subject")) 'Adds subject values pertaining to the Book that was created in
Create Book form.
Next
End Sub
Private Sub searchdatas(ByVal searchword As String)
Dim sqlString As String = "Select Distinct(Title) From BookMaster A, BookGrade B, BookSubject C"
'Searches the book entries by title, keyword or author name
Dim sqlWhere As String
Dim subjectList As String = String.Empty
Dim gradeList As String = String.Empty
sqlWhere = " Where ((Upper(Title) like '%" & searchword & "%') or (Upper(Author) like '%" &
searchword & "%'))" 'searches database by Book Title or Author name
For Each item As ListViewItem In lsvSubject.CheckedItems 'Populates the Books list post selective of
Subjects
If (subjectList = String.Empty) Then
subjectList = "'" & item.Text & "'"
Else
subjectList = subjectList & ",'" & item.Text & "'"
End If
Next
For Each item As ListViewItem In lsvGradeLevel.CheckedItems 'Populates the Books list post selective of
Grade Levels
If (gradeList = String.Empty) Then
gradeList = "'" & item.Text & "'"
Else
gradeList = gradeList & ",'" & item.Text & "'"
End If
Next
If (lsvGradeLevel.CheckedItems.Count > 0) Then 'If more than 1 grade level is chosen just populates the
books with multiple grade levels.
sqlWhere = sqlWhere & " and (GradeLevel in (" & gradeList & "))"
sqlWhere = sqlWhere & " and (A.BookID = B.BookID)"
End If
If (lsvSubject.CheckedItems.Count > 0) Then 'Populates the books list with multiple subject levels.
sqlWhere = sqlWhere & " and (Subject in (" & subjectList & "))"
sqlWhere = sqlWhere & " and (A.BookID = C.BookID)"
End If
sqlString = sqlString & sqlWhere
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString, conn)
Dim adapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(command)
Dim booktMaster As DataTable = New DataTable
20
adapter.Fill(booktMaster)
lstTemplates.Items.Clear()
For Each row As DataRow In booktMaster.Rows
lstTemplates.Items.Add(row("Title"))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
searchdatas(TextBox1.Text.ToUpper) 'Search button used to search the database after chosing different
criteria
End Sub
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
Dim oForm As New Form2
oForm.Show()
Me.Hide()
End Sub
Private Sub ReadBook_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
ReadBook.Click
'Dim - declares and allocates temporary storage space for a variable
'As - the data type
Dim MyApplication As PowerPoint.Application
Dim MyPresentation As PowerPoint.Presentation
Dim MySlide As PowerPoint.Slide
Dim MyAssistantOn As Boolean
MyApplication = New PowerPoint.Application() 'Selects and play's the Powerpoint in Powerpoint Show
format
MyApplication.Visible = True
MyApplication.WindowState = PowerPoint.PpWindowState.ppWindowMaximized
Dim fileName As String = lstTemplates.SelectedItem.ToString()
fileName = AppDomain.CurrentDomain.BaseDirectory + "PowerPoint\" + fileName + ".PPS" 'Chooses the
PPS show file from the Powerpoint folder pertaining to the title.
MyPresentation = MyApplication.Presentations.Open(fileName, , , True)
End Sub
Private Sub CreateBooklabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
CreateBooklabel9.Click
End Sub
End Class
21
Figure 8 – Accessible Books Edit Book
Read Book
Imports Microsoft.Office.Interop 'add t he Microsoft Office Library
Imports System.Data
Public Class Form5
Dim conn As New SqlClient.SqlConnection
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ConnectToSql()
Dim sqlString As String = "Select Title From BookMaster"
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString,
conn)
Dim adapter As SqlClient.SqlDataAdapter = New
SqlClient.SqlDataAdapter(command)
Dim titleMaster As DataTable = New DataTable
adapter.Fill(titleMaster)
lstTemplates.Items.Clear()
For Each row As DataRow In titleMaster.Rows
lstTemplates.Items.Add(row("Title"))
Next
PopulateGrade()
PopulateSubject()
22
End Sub
Private Sub ConnectToSql()
' TODO: Modify the connection string and include any
' additional required properties for your database.
conn.ConnectionString = "integrated security=SSPI;data
source=(local)\SQLEXPRESS;" & _
"persist security info=False;database=Library"
Try
conn.Open()
' Insert code to process data.
Catch ex As Exception
Windows.Forms.MessageBox.Show("Failed to connect to data source")
End Try
End Sub
Private Sub lstTemplates_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lstTemplates.SelectedIndexChanged
Dim fileName As String = lstTemplates.SelectedItem.ToString()
fileName = AppDomain.CurrentDomain.BaseDirectory + "PowerPoint\" +
fileName + ".htm"
WebBrowser1.Navigate(fileName, False)
End Sub
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
e.Cancel = True
End Sub
Private Sub PopulateGrade()
Dim sqlString As String = "Select Distinct(GradeLevel) From BookGrade"
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString,
conn)
Dim adapter As SqlClient.SqlDataAdapter = New
SqlClient.SqlDataAdapter(command)
Dim gradeMaster As DataTable = New DataTable
adapter.Fill(gradeMaster)
For Each row As DataRow In gradeMaster.Rows
lsvGradeLevel.Items.Add(row("GradeLevel"))
Next
End Sub
Private Sub PopulateSubject()
Dim sqlString As String = "Select Distinct(Subject) From BookSubject"
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString,
conn)
Dim adapter As SqlClient.SqlDataAdapter = New
SqlClient.SqlDataAdapter(command)
23
Dim subjectMaster As DataTable = New DataTable
adapter.Fill(subjectMaster)
For Each row As DataRow In subjectMaster.Rows
lsvSubject.Items.Add(row("Subject"))
Next
End Sub
Private Sub searchdatas(ByVal
Dim sqlString As String =
BookGrade B, BookSubject C"
Dim sqlWhere As String
Dim subjectList As String
Dim gradeList As String =
searchword As String)
"Select Distinct(Title) From BookMaster A,
= String.Empty
String.Empty
sqlWhere = " Where ((Upper(Title) like '%" & searchword & "%') or
(Upper(Author) like '%" & searchword & "%'))"
For Each item As Windows.Forms.ListViewItem In lsvSubject.CheckedItems
If (subjectList = String.Empty) Then
subjectList = "'" & item.Text & "'"
Else
subjectList = subjectList & ",'" & item.Text & "'"
End If
Next
For Each item As Windows.Forms.ListViewItem In lsvGradeLevel.CheckedItems
If (gradeList = String.Empty) Then
gradeList = "'" & item.Text & "'"
Else
gradeList = gradeList & ",'" & item.Text & "'"
End If
Next
If (lsvGradeLevel.CheckedItems.Count > 0) Then
sqlWhere = sqlWhere & " and (GradeLevel in (" & gradeList & "))"
sqlWhere = sqlWhere & " and (A.BookID = B.BookID)"
End If
If (lsvSubject.CheckedItems.Count > 0) Then
sqlWhere = sqlWhere & " and (Subject in (" & subjectList & "))"
sqlWhere = sqlWhere & " and (A.BookID = C.BookID)"
End If
sqlString = sqlString & sqlWhere
Dim command As SqlClient.SqlCommand = New SqlClient.SqlCommand(sqlString,
conn)
Dim adapter As SqlClient.SqlDataAdapter = New
SqlClient.SqlDataAdapter(command)
24
Dim booktMaster As DataTable = New DataTable
adapter.Fill(booktMaster)
lstTemplates.Items.Clear()
For Each row As DataRow In booktMaster.Rows
lstTemplates.Items.Add(row("Title"))
Next
End Sub
Private Sub ReadBook_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
'Dim - declares and allocates temporary storage space for a variable
'As - the data type that
Dim MyApplication As PowerPoint.Application
Dim MyPresentation As PowerPoint.Presentation
Dim MySlide As PowerPoint.Slide
Dim MyAssistantOn As Boolean
MyApplication = New PowerPoint.Application()
MyApplication.Visible = True
MyApplication.WindowState = PowerPoint.PpWindowState.ppWindowMaximized
Dim fileName As String = lstTemplates.SelectedItem.ToString()
fileName = AppDomain.CurrentDomain.BaseDirectory + "PowerPoint\" +
fileName + ".PPS"
MyPresentation = MyApplication.Presentations.Open(fileName, , , True)
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitButton.Click
Dim oForm As New Form3
oForm.Show()
Me.Hide()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim oForm As New Form2
oForm.Show()
Me.Hide()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim oForm As New Form1
oForm.Show()
Me.Hide()
25
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PictureBox2.Click
'Dim - declares and allocates temporary storage space for a variable
'As - the data type that
Dim MyApplication As PowerPoint.Application
Dim MyPresentation As PowerPoint.Presentation
Dim MySlide As PowerPoint.Slide
Dim MyAssistantOn As Boolean
MyApplication = New PowerPoint.Application()
MyApplication.Visible = True
MyApplication.WindowState = PowerPoint.PpWindowState.ppWindowMaximized
Dim fileName As String = lstTemplates.SelectedItem.ToString()
fileName = AppDomain.CurrentDomain.BaseDirectory + "PowerPoint\" +
fileName + ".PPS"
MyPresentation = MyApplication.Presentations.Open(fileName, , , True)
End Sub
End Class
Figure 9 – Accessible Books Read Book
26
Download