Click here to Skip to main content
15,923,689 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how to handle Null Datagridview cell value Pin
janmas12-May-10 1:19
janmas12-May-10 1:19 
QuestionVideo thumbnail Pin
renu.iitkgp11-May-10 22:53
renu.iitkgp11-May-10 22:53 
AnswerRe: Video thumbnail [modified] Pin
Johnny J.12-May-10 3:36
professionalJohnny J.12-May-10 3:36 
AnswerRe: Video thumbnail Pin
Luc Pattyn12-May-10 3:55
sitebuilderLuc Pattyn12-May-10 3:55 
QuestionThreading and Classes Pin
TheComputerMan11-May-10 10:03
TheComputerMan11-May-10 10:03 
AnswerRe: Threading and Classes Pin
Luc Pattyn11-May-10 10:15
sitebuilderLuc Pattyn11-May-10 10:15 
GeneralRe: Threading and Classes Pin
TheComputerMan11-May-10 10:19
TheComputerMan11-May-10 10:19 
Questionvb.net pasting images into powerpoint Pin
b-rad31111-May-10 9:57
b-rad31111-May-10 9:57 
Hi everyone,

I've written a visual basic gui program (using visual studio 2008 (.net)) and simply placed a button on it which, when pressed, activates the print screen of the active window and it then opens powerpoint, adds a slide, and it's then suppose to paste the image. A new slide gets created each time the button is pressed, and the image is supposed to be pasted to the new slide.

The first iteration seems to work fine, but subsequent presses of the button yields the following error:
"System.Runtime.InteropServices.COMException (0x80048240): Shapes (unknown member) : Invalid request. Clipboard is empty or contains data which may not be pasted here. at Microsoft.Office.Interop.PowerPoint.Shapes.Paste()"

Other times the code goes an unlimited amount of button presses with no error, but when this occurs, the image is only updated every other button press. Any ideas?

Imports Microsoft.Office.Interop
Imports Microsoft.Office.Core
Imports System.Drawing.Imaging

Imports System.Runtime.InteropServices
Imports System.Diagnostics


Public Class Form1

    ' Start PowerPoint.
    Public ppApp As PowerPoint.Application

    ' Start counting number of times the take image button has been pressed by the user.
    Public num_times_pressed = 0

    ' Add a new presentation.
    Public ppPres As PowerPoint.Presentation


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
num_times_pressed = num_times_pressed + 1
    

        If num_times_pressed = 1 Then
            ppApp = CreateObject("Powerpoint.Application")

            ' Make it visible.
            ppApp.Visible = True

            ppPres = ppApp.Presentations.Add(MsoTriState.msoTrue)
            ppApp.WindowState = PowerPoint.PpWindowState.ppWindowMinimized

            

        End If

        ' Add a new slide.
        Dim ppSlide1 As PowerPoint.Slide
        Dim SlideCount As Long

        SlideCount = ppPres.Slides.Count
        ppSlide1 = ppPres.Slides.Add(SlideCount + 1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutBlank)

        Me.Hide()
        
        SendKeys.SendWait("%{Prtsc}")
        
        ppSlide1.Select()
        

        ppSlide1.Shapes.Paste()
        

        
        Me.Show()
            End Sub
End Class


Thanks!
AnswerRe: vb.net pasting images into powerpoint Pin
Johan Hakkesteegt11-May-10 20:20
Johan Hakkesteegt11-May-10 20:20 
GeneralRe: vb.net pasting images into powerpoint Pin
b-rad31112-May-10 5:12
b-rad31112-May-10 5:12 
QuestionLicense not found error for dirDDBox and dirListBox Pin
Andraw Tang11-May-10 9:39
Andraw Tang11-May-10 9:39 
AnswerRe: License not found error for dirDDBox and dirListBox Pin
Dave Kreskowiak11-May-10 9:54
mveDave Kreskowiak11-May-10 9:54 
GeneralRe: License not found error for dirDDBox and dirListBox Pin
Andraw Tang11-May-10 10:02
Andraw Tang11-May-10 10:02 
GeneralRe: License not found error for dirDDBox and dirListBox Pin
Dave Kreskowiak11-May-10 10:13
mveDave Kreskowiak11-May-10 10:13 
GeneralRe: License not found error for dirDDBox and dirListBox Pin
Andraw Tang11-May-10 10:21
Andraw Tang11-May-10 10:21 
GeneralRe: License not found error for dirDDBox and dirListBox Pin
Dave Kreskowiak11-May-10 10:42
mveDave Kreskowiak11-May-10 10:42 
GeneralRe: License not found error for dirDDBox and dirListBox Pin
Andraw Tang11-May-10 10:51
Andraw Tang11-May-10 10:51 
GeneralRe: License not found error for dirDDBox and dirListBox Pin
Andraw Tang11-May-10 11:10
Andraw Tang11-May-10 11:10 
QuestionVB bound data combo boxes. [SOLVED] Pin
ahulting11-May-10 3:01
ahulting11-May-10 3:01 
AnswerRe: VB bound data combo boxes. Pin
Johan Hakkesteegt11-May-10 3:11
Johan Hakkesteegt11-May-10 3:11 
GeneralRe: VB bound data combo boxes. Pin
ahulting11-May-10 3:14
ahulting11-May-10 3:14 
GeneralRe: VB bound data combo boxes. Pin
Johan Hakkesteegt11-May-10 3:20
Johan Hakkesteegt11-May-10 3:20 
GeneralRe: VB bound data combo boxes. Pin
ahulting11-May-10 6:14
ahulting11-May-10 6:14 
AnswerRe: VB bound data combo boxes. Pin
William Winner11-May-10 6:21
William Winner11-May-10 6:21 
GeneralRe: VB bound data combo boxes. Pin
ahulting11-May-10 6:28
ahulting11-May-10 6:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.