I tried to use Activex Control But I get error that "
I Tried Below Code :
AxAcroPDF a = new AxAcroPDF();
axAcroPDF1.CreateControl();
a.LoadFile(Application.StartupPath + "\\Reports\\");
a.Show();
axAcroPDF1.CreateControl();
a.LoadFile(Application.StartupPath + "\\Reports\\");
a.Show();
I Got Error-
How to fix it error that Sysytem.windows.form AxHost.InvalidActiveXStateException " was through
If There Is any other option Then plz tel me.

Dipankar BiswasRank #992 · 2K reputationPosted Aug 3, 2014, 9:59 PM EDT
store this path into database like this
upload path..
like this:
Private Sub btn_brs_mat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_brs_mat.Click
OpenFileDialog1.ShowDialog()
file = OpenFileDialog1.FileNames
txt_up_math_qus.Text = file(0)
'ComboBox2.Text = System.IO.Path.GetFileName(OpenFileDialog1.FileName)
End Sub
Inserted code:
If Not conn.State = ConnectionState.Open Then
conn.Open()
End If
cmd.Connection = conn
cmd.CommandText = "insert into Qus_upload_tbl(Subject_1,Subject_2,Subject_3,Subject_4,Subject_5,Date_Time)" & _
" Values('" & Me.txt_up_math_qus.Text & "','" & Me.txt_up_Reasoning_qus.Text & "','" & Me.txt_up_english_qus.Text & "','" & Me.txt_up_banking_qus.Text & "','" & _
Me.txt_up_computer_qus.Text & "','" & Me.txt_date.Text & "') "
cmd.ExecuteNonQuery()
'refrash data
RefreshData()
'close
conn.Close()
Show: Code
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Dim i As Integer
i = DataGridView1.CurrentRow.Index
'Me.AxAcroPDF1.src = DataGridView1.Item(0, i).Value
If Me.DataGridView1.CurrentCell.ColumnIndex = 1 Then
Me.AxAcroPDF1.src = DataGridView1.Item(1, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 2 Then
Me.AxAcroPDF1.src = DataGridView1.Item(2, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 3 Then
Me.AxAcroPDF1.src = DataGridView1.Item(3, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 4 Then
Me.AxAcroPDF1.src = DataGridView1.Item(4, i).Value
End If
If Me.DataGridView1.CurrentCell.ColumnIndex = 5 Then
Me.AxAcroPDF1.src = DataGridView1.Item(5, i).Value
End If
End Sub
its a simple ,but are u know how to show data from database????
if you know.. then its simple..
Dipika Wani3 reputationPosted Aug 3, 2014, 11:01 PM EDT
Dipankar BiswasRank #992 · 2K reputationPosted Aug 4, 2014, 1:56 AM EDT
your ans:
Open new project>
you need
1 TextBox
1 Button
then go toolbox>
Rightclick>
Choose Item>
then you will show this dialog box
select >Adobe PDF Reader
>OK
Like this...
>>>code
Result:...
Thanks
Dipankar Biswas
Boris Tukaric4 reputationPosted Mar 6, 2016, 11:31 PM EST
Lisa White141 reputationPosted Mar 7, 2016, 3:28 PM EST
private void toolStripButton1_Click(object sender, EventArgs e) { string pdfDoc = @"D:\michelle\e-iceblue\Spire.Office.pdf"; if (File.Exists(pdfDoc)) { this.pdfDocumentViewer1.LoadFromFile(pdfDoc); } }private void toolStripButton1_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "PDF document (*.pdf)|*.pdf"; DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { try { string pdfFile = dialog.FileName; this.pdfDocumentViewer1.LoadFromFile(pdfFile); } catch (Exception exe) { MessageBox.Show(exe.Message, "Spire.PdfViewer Demo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }Boris Tukaric4 reputationPosted Mar 7, 2016, 7:50 PM EST