Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a form that can show the result of my student.

The problems are:

1. I want to print the result by pressing "Oke" button and input it into Nama, NIM, Tugas, Ulangan, UTS, UAS, hasil and skor to Microsoft Word template that I've created.

This is the docx template: this is the docx template :

Docx Template[^]

2. I don't know how the code is and how to do that.

Please help me.

What I have tried:

This is the program's look:

The Program[^]

The VB.NET Code is :

VB
Public Class Form2
    Private Sub PenilaianBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)
        Me.Validate()
        Me.PenilaianBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.MahasiswaDataSet)

    End Sub

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'MahasiswaDataSet.penilaian' table. You can move, or remove it, as needed.
        Me.PenilaianTableAdapter.Fill(Me.MahasiswaDataSet.penilaian)
        NimTextBox.Text = ""
        NamaLabel1.Text = ""
        NimLabel1.Text = ""
        TugasLabel1.Text = ""
        UlanganLabel1.Text = ""
        UtsLabel1.Text = ""
        UasLabel1.Text = ""
        HasilLabel1.Text = ""
        SkorLabel1.Text = ""
    End Sub

    Private Sub btnoke_Click(sender As Object, e As EventArgs) Handles btnoke.Click
        Try
            Dim dt = PenilaianTableAdapter.GetDataBycaridata(NimTextBox.Text)
            If dt.Rows.Count <> 0 Then
                NamaLabel1.Text = dt.Rows(0).Item(1)
                NimLabel1.Text = dt.Rows(0).Item(2)
                TugasLabel1.Text = dt.Rows(0).Item(3)
                UlanganLabel1.Text = dt.Rows(0).Item(4)
                UtsLabel1.Text = dt.Rows(0).Item(5)
                UasLabel1.Text = dt.Rows(0).Item(6)
                HasilLabel1.Text = dt.Rows(0).Item(7)
                SkorLabel1.Text = dt.Rows(0).Item(8)
            Else
                MsgBox("NIM Yang Anda Input Salah Atau Data Anda Belum Diinput. Silahkan Coba Lagi", MsgBoxStyle.Critical, "Info")
                NimTextBox.Text = ""
                NamaLabel1.Text = ""
                NimLabel1.Text = ""
                TugasLabel1.Text = ""
                UlanganLabel1.Text = ""
                UtsLabel1.Text = ""
                UasLabel1.Text = ""
                HasilLabel1.Text = ""
                SkorLabel1.Text = ""
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Hide()
        Form3.Show()
    End Sub
End Class
Posted
Updated 25-Oct-17 22:03pm

1 solution

YouTube has a number of videos that will walk you through what you are wanting to do: ms word vb.net - YouTube[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900