Click here to Skip to main content
15,918,889 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Error on:user defined type not defined??- vb6 Pin
Dave Kreskowiak17-Oct-06 17:48
mveDave Kreskowiak17-Oct-06 17:48 
GeneralRe: Error on:user defined type not defined??- vb6 Pin
campbells17-Oct-06 17:48
campbells17-Oct-06 17:48 
GeneralRe: Error on:user defined type not defined??- vb6 Pin
Dave Kreskowiak17-Oct-06 17:56
mveDave Kreskowiak17-Oct-06 17:56 
Questionhow to click a button then mySQL will create the procedure? [urgent] Pin
campbells17-Oct-06 15:44
campbells17-Oct-06 15:44 
AnswerRe: how to click a button then mySQL will create the procedure? [urgent] Pin
Christian Graus17-Oct-06 15:55
protectorChristian Graus17-Oct-06 15:55 
QuestionVB6/WinAPI - Setting process priority to interactive Pin
darkoex17-Oct-06 14:46
darkoex17-Oct-06 14:46 
QuestionDrag and Drop file to Desktop, Email, etc. Pin
CarlMoser17-Oct-06 9:06
CarlMoser17-Oct-06 9:06 
AnswerRe: Drag and Drop file to Desktop, Email, etc. Pin
CarlMoser18-Oct-06 7:44
CarlMoser18-Oct-06 7:44 
'Here is the Drag and Drop Code from above - VB.NET 2005.
'
'Problem 1:
'When I drag and drop a file name from ListBox1 to PictureBox1, it works.
'When I drag and drop a filename from ListBox1 to Outlook Email for use
'as an attachment, I get the filename text inserted.
'
'Problem 2:
'When I try and drag and drop from the PictureBox1 to Outlook or
'the Paint program, I get nothing.
'
'Any Ideas on how to fix this???????
'--------------------------------------------------------------------


Public Class Form1

'The Problem lies in the SelectedItem property. Actually if you do the mouse
'down the item is not already selected. You have to use the SelectedIndex
'and get then the the according item. Please find the code below which is
'working.

Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
If e.Button = MouseButtons.Left Then
If ListBox1.SelectedIndex > -1 Then

ListBox1.DoDragDrop(ListBox1.Items.Item(ListBox1.SelectedIndex).ToString, DragDropEffects.Copy)

End If
End If
End Sub


Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown

Dim o As New DataObject
o.SetData(DataFormats.Bitmap, PictureBox1.Image)
PictureBox1.DoDragDrop(o.GetData(DataFormats.Bitmap, True), DragDropEffects.Copy)

End Sub


Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Debug.WriteLine("SelectedIndexChanged - " & ListBox1.SelectedItem.ToString)
End Sub


Private Sub PictureBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragEnter
If e.Data.GetDataPresent(GetType(System.String)) = True Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.Link

End If
End Sub


Private Sub PictureBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragDrop
If Not PictureBox1.Image Is Nothing Then
PictureBox1.Image.Dispose()
PictureBox1.Image = Nothing
End If
PictureBox1.Image = Image.FromFile(CStr(e.Data.GetData(GetType(System.String))))
End Sub


Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub


Private Sub FillListBox()
'Fill list box with list of bitmap files in the Windows directory
ListBox1.DataSource = System.IO.Directory.GetFiles("C:\Windows\", "*.bmp")
End Sub


Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
FillListBox()
PictureBox1.AllowDrop = True

End Sub

End Class

QuestionRunning application first time after install. Pin
dptalt17-Oct-06 8:02
dptalt17-Oct-06 8:02 
AnswerRe: Running application first time after install. Pin
aparna.shukla117-Oct-06 21:35
aparna.shukla117-Oct-06 21:35 
QuestionWorking with a textbox's read only property at runtime . . . Pin
Shawn Owens17-Oct-06 6:57
Shawn Owens17-Oct-06 6:57 
AnswerRe: Working with a textbox's read only property at runtime . . . Pin
Christian Graus17-Oct-06 7:11
protectorChristian Graus17-Oct-06 7:11 
GeneralRe: Working with a textbox's read only property at runtime . . . Pin
Shawn Owens17-Oct-06 7:20
Shawn Owens17-Oct-06 7:20 
GeneralRe: Working with a textbox's read only property at runtime . . . Pin
Christian Graus17-Oct-06 8:09
protectorChristian Graus17-Oct-06 8:09 
GeneralRe: Working with a textbox's read only property at runtime . . . Pin
Shawn Owens17-Oct-06 8:32
Shawn Owens17-Oct-06 8:32 
GeneralRe: Working with a textbox's read only property at runtime . . . Pin
Christian Graus17-Oct-06 9:58
protectorChristian Graus17-Oct-06 9:58 
GeneralRe: Working with a textbox's read only property at runtime . . . Pin
Dave Kreskowiak17-Oct-06 10:24
mveDave Kreskowiak17-Oct-06 10:24 
GeneralRe: Working with a textbox's read only property at runtime . . . Pin
Shawn Owens18-Oct-06 10:23
Shawn Owens18-Oct-06 10:23 
QuestionFew Questions " dialog box" " global variable" Pin
Ultima Reborn17-Oct-06 5:52
Ultima Reborn17-Oct-06 5:52 
AnswerRe: Few Questions " dialog box" " global variable" Pin
Christian Graus17-Oct-06 7:08
protectorChristian Graus17-Oct-06 7:08 
AnswerRe: Few Questions " dialog box" " global variable" Pin
UltraCoder17-Oct-06 7:52
UltraCoder17-Oct-06 7:52 
GeneralRe: Few Questions " dialog box" " global variable" Pin
Dave Kreskowiak17-Oct-06 10:02
mveDave Kreskowiak17-Oct-06 10:02 
AnswerRe: Few Questions " dialog box" " global variable" Pin
UltraCoder17-Oct-06 10:11
UltraCoder17-Oct-06 10:11 
GeneralRe: Few Questions " dialog box" " global variable" [modified] Pin
Dave Kreskowiak17-Oct-06 10:25
mveDave Kreskowiak17-Oct-06 10:25 
QuestionRe: Few Questions "dialog box""global variable" Pin
Ultima Reborn17-Oct-06 10:28
Ultima Reborn17-Oct-06 10: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.