|
Hi,
Can anyone guide me on how to do the following cenerio:
I have a table:
ID type int
Data type image
Now on a form in vb.net, I drop the control data field as a picturebox.
I want to double click on the picturebox to load a pdf file so that i can store in the table.
a button to view the pdf file.
I tried to do it as a simple picturebox for gif, etc.. it does not work.
the idea behind this is to be able to store the pdf in a table as normally do for a picture.
Also once I acheive this, i would like to view the pdf file.
I would appreciate if anyone can send the code to do this. even if it is not with my approach but the same result.
Thanks a lot.
|
|
|
|
|
Since a PictureBox control knows nothing about the PDF file format, it can't render one at all.
You'll have to use another control, such as PdfSharp or some other PDF Viewing control.
|
|
|
|
|
thanks for your response.
I load the pdf file into webbrowser control. Now i need to save into a table. the form in question already has a dataset binding into it. I neesd to take the pdf file that's showing in the webbrowser control and to be saved with every control on the form.
Here the code below that I used:
Dim Response As DialogResult
OpenFileDialog1.FileName = ""
OpenFileDialog1.Filter = "PDF Files(*.pdf)|*.pdf|All Files(*.*)|*.*"
Response = OpenFileDialog1.ShowDialog()
If Response <> Windows.Forms.DialogResult.Cancel Then
If OpenFileDialog1.FileName <> "" Then
cmdBrowse.Navigate(OpenFileDialog1.FileName)
End If
End If
i have a table name ManifestTD with dataset ManifestTD_dataset with column (ID as PK, Data as Binary(MAX)
How to get this save into the table ; also be able to doubleclick to the webbrowser command to view the entire pdf document through adobe
Thanks again.
|
|
|
|
|
You can save the contents of the PDF file to the database the exact same way you save any other image format. Like this[^] or this[^].
|
|
|
|
|
I have a form that has various pictureboxes that are populated by the user. Once the form has all the pictureboxes full, the user needs to save the whole form and its contents as a jpg. The only problem is that the only thing that is saved is the picturebox.1.
Case 1
form2.PictureBox1.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Jpeg)
I can see that in Case 1 section I am telling the program to save the PictureBox1 in form 2 but I want it to merge all the PictureBoxs in form 2 and save as a jpg. Can anyone tell me where I am going wrong
Dim saveFileDialog1 As New SaveFileDialog()
saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif"
saveFileDialog1.Title = "Save an Image File"
saveFileDialog1.ShowDialog()
If saveFileDialog1.FileName <> "" Then
Dim fs As System.IO.FileStream = CType _
(saveFileDialog1.OpenFile(), System.IO.FileStream)
Select Case saveFileDialog1.FilterIndex
Case 1
form2.PictureBox1.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Jpeg)
Case 2
Me.Button2.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Bmp)
Case 3
Me.Button2.Image.Save(fs, _
System.Drawing.Imaging.ImageFormat.Gif)
End Select
fs.Close()
End If
|
|
|
|
|
tuffhamster wrote: I have a form that has various pictureboxes that are populated by the user. Once the form has all the pictureboxes full, the user needs to save the whole form and its contents as a jpg.
Call the DrawToBitmap[^] method of the form.
|
|
|
|
|
I have used the drawtobitmap as suggested but still only copies the form background. There are about 8 picture boxes in the form but none of these are saved within the jpg. Here is the code.
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim savefiledialog1 As New SaveFileDialog
savefiledialog1.Title = "Render"
savefiledialog1.FileName = "Render Image"
savefiledialog1.Filter = "jpg |*.jpg| png |*.png| bmp |*.bmp| gif |*.gif"
If savefiledialog1.ShowDialog() = DialogResult.OK Then
Dim bmp As New Drawing.Bitmap(Form2.Width, Form2.Height)
Form2.DrawToBitmap(bmp, New Rectangle(0, 0, bmp.Width, bmp.Height))
bmp.Save(savefiledialog1.FileName, Imaging.ImageFormat.Icon)
End If
End Sub
|
|
|
|
|
As should be; that's how the stuff works. If you want a "mashup", you'll have to draw the pictureboxes by hand, on the forms' paint event.
|
|
|
|
|
Can anybody help me to solve this problem...
I am facing the below problem while trying to send mail in Vb6.0
Problem was encountered when trying send mail- ActiveX component can't create object.
Would Appreciate help...
|
|
|
|
|
Check the outlook is configured on particular machine.
Also check the outlook reference is added or not in your application.
Still problem is not resolved, then send the line of code, i will correct it.
|
|
|
|
|
Can anybody help me to solve this problem...
I am facing the below problem while trying to send mail in Vb6.0
Problem was encountered when trying send mail- ActiveX component can't create object.
Appreciate your help...
|
|
|
|
|
From this Google search I think the top 2 results might be a good place to start
Google: VB6 sendmail - ActiveX component can't create object[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Hi
how to give Chinese characters as in put in a Text box in vb.net. i need to enter the charecter through key bord.
and how display the chineses charectes in datagrid in vb.net.
|
|
|
|
|
Install a Chinese keyboard with the Language Bar of Windows. Set the focus to your text box, then select "Chinese" from the Language Bar, and type: "川宫" (don't know what it means, just typed some characters on my German keyboard with the Chinese keyboard selected in the LanguageBar...)
|
|
|
|
|
Hello all,
I have built a C++ class like this:
class MyClass {
public:
int x;
MyClass();
virtual void f1(int);
virtual void f2();
virtual void f3();
};
extern "C" DLLIMPORT void* MCSet(int);
extern "C" DLLIMPORT void MCKill();
extern "C" DLLIMPORT int MCGet();
extern "C" DLLIMPORT void DoStuff(MyClass); I also made a client *.exe that uses all MyClass features. Can someone tell me if it is possible to call MyClass from vba and do the same? If so, how? (A sample code would be very helpfull )
[]'s
|
|
|
|
|
I developed a hotel bill In Windows form application(visual basic 2010)
i created a database with Column names
1.S_No
2.ItemName
3.Quantity
4.Price
5.Total
6.GrandTotal
And i added this database to my form and i dragged and dropped as Details view. I arranged columns in horizontal format. Grand total button at end form. i selected all text boxes excluding grand total textbox. by holding Ctrl key i made duplicates to all text boxes in the same horizontal columns. The first text boxes are correctly working correctly.but the duplicates box values although i inserted they are not assigning to database(when i pressed save icon on top)(only first Row boxes are saved) what to do please help me. provide the code in visual basic 2010 format. if you don't understand i will mail my complete project to you please please help me
|
|
|
|
|
I want to an admin Login page for My Form How to create that form that checks user name and password and allow to second form
|
|
|
|
|
In your VB.NET application IDE there is ALREADY a LOGIN form Template!
Why not use that one and add yuor code to query yuor members dtabase?
|
|
|
|
|
I have an the following application setting [Name: PO / Type: Integer / Scope: User / Value: 100001]
This setting increments every time the user logs into the application and is displayed in a textbox - it is working fine on 4 different workstations - but on workstation 5 it is only displaying 1 then 2 then 3 and so on instead of 100001,100002,100003 . . . ..
There is a mixture of operating systems anything from XP to Windows 8. Workstation 5 is Windows 7.
Is there something obvious I'm missing?
Thanks,
MB
|
|
|
|
|
Without knowing anything about how you implemented this functionality, it's pretty much impossible to tell you what's going wrong.
How are you getting this setting and from where? How are you updating this setting and persisting it?? We'd need to see the relavent code snippets.
|
|
|
|
|
OK - lets see if this helps - have the following variable under Public Class Main:
Dim poIncNo As Integer
Then in the formLoad Event I have:
txtBx_poNo.Text = genPoNo(currUser)
Private Function genPoNo(ByVal user As String) As String
Dim strNum As String = "1"
poIncNo = My.Settings.po + 1
Dim poNum As String
Select Case user
Case uFred
poNum = strNum & userId + CStr(poIncNo)
Return poNum
End Select
End Function
In Application.Settings I have:
Name = po
Type = integer
Scope = user
Value = 100001
Thanks,
MB
|
|
|
|
|
OK, so are these application-scope settings or user-scope settings??
You also don't have any code in what you posted that sets the settings with new values and persists them.
|
|
|
|
|
Dave,
It is 'user-scope'
Private Function genPoNo(ByVal user As String) As String
08 Dim strNum As String = "1"
09 poIncNo = My.Settings.po + 1 '----IT'S INCREMENTED HERE !
10 Dim poNum As String
11 Select Case user
12 Case uFred
13 poNum = strNum & userId + CStr(poIncNo)
14 Return poNum
15 End Select
16 End Function
Thanks MB
|
|
|
|
|
mebjen wrote: poIncNo = My.Settings.po + 1 '----IT'S INCREMENTED HERE !
NO, IT'S NOT! You set the value of poIncNo to the setting + 1, but you never showed where you saved that new value back into settings!
|
|
|
|
|
Hi
I have a strange problem which i am not sure if it is an issue in VB
Public Class Form1
Private moving As Boolean = False
Private Sub Label2_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label2.MouseDown
If e.Button = Windows.Forms.MouseButtons.Left Then
moving = True
End If
End Sub
Private Sub Label2_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label2.MouseUp
moving = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label3.Text = moving
End Sub
Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Dim eLocation As New System.Drawing.Point(e.X, e.Y)
If moving = True Then
Label1.Text = "X." & e.X & vbCrLf & "Y." & e.Y
Label2.Location = eLocation
End If
End Sub
End Class
There is a label on the form and when you click on it is should be dragable on the form. The issue is that the flag is not been set on the mouse down event but I am not sure why or if it is the mouse move event where I test for the flag is always false. If I take the test for the flag out of the mouse move the label follows the mouse with the left mouse button down so all events seem to be working. If I declare the flag as true at start up the label also follows the mouse until the left button is pressed and released resetting the flag. I have also tried removing the flag reset in mouse up event, this actually starts to work when the left button is released.
Any help would be appreciated
Col
VB Express 2010
|
|
|
|