Click here to Skip to main content
15,902,777 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Adding a new row to a dataset Pin
Tom Deketelaere13-Sep-07 23:27
professionalTom Deketelaere13-Sep-07 23:27 
GeneralRe: Adding a new row to a dataset Pin
Dave Kreskowiak14-Sep-07 5:29
mveDave Kreskowiak14-Sep-07 5:29 
GeneralRe: Adding a new row to a dataset Pin
Tom Deketelaere14-Sep-07 5:43
professionalTom Deketelaere14-Sep-07 5:43 
GeneralRe: Adding a new row to a dataset Pin
Dave Kreskowiak14-Sep-07 8:00
mveDave Kreskowiak14-Sep-07 8:00 
GeneralRe: Adding a new row to a dataset Pin
Tom Deketelaere16-Sep-07 3:01
professionalTom Deketelaere16-Sep-07 3:01 
GeneralRe: Adding a new row to a dataset Pin
Dave Kreskowiak16-Sep-07 4:39
mveDave Kreskowiak16-Sep-07 4:39 
GeneralRe: Adding a new row to a dataset Pin
Dave Kreskowiak14-Sep-07 5:28
mveDave Kreskowiak14-Sep-07 5:28 
Questionaddhandlers and addressofs Pin
Cedrickdeorange13-Sep-07 14:25
Cedrickdeorange13-Sep-07 14:25 
I'm having a problem with the Addressof part. Do i have to do a sub procedure for the click events, if so how? Do I use the performclick method?

I have added the part of code i'm using.

Any help or advice will be welcomed.

Dim mnuFileRecent1 As New MenuItem
Dim mnuFileRecent2 As New MenuItem
Dim mnuFileRecent3 As New MenuItem
Dim mnuFileRecent4 As New MenuItem
Dim RecentFiles(3) As String
Dim ThePath As String
Dim I As Integer

Private Function AppPath() As String
Dim A As String
'Executing file location and name
A = Reflection.Assembly.GetExecutingAssembly.Location
'Strip off file name
A = Mid(A, 1, InStrRev(A, "\"))
Return (A)
End Function

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

End Sub

Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOprn.Click
If dlgOpen.ShowDialog() = DialogResult.OK Then
FileOpen(1, dlgOpen.FileName, OpenMode.Input)
txtOutput.Text = InputString(1, CInt(LOF(1)))
txtOutput.SelectionLength = 0
FileClose(1)
ThePath = dlgOpen.FileName
RearrangeFiles(ThePath)
End If

End Sub

Private Sub RearrangeFiles(ByVal F As String)

'Reorder the four most recent files located in the menu structure
Dim TempArray(4) As String
Dim TempArrayCounter As Integer = 1
Dim i As Integer
'The first item is the name of the file just opened.
TempArray(0) = F
'Loop the the origonal array, if the item is not the
'same as the new file opened add it to the temp array.
For i = 0 To 3
If RecentFiles(i) <> F Then
TempArray(TempArrayCounter) = RecentFiles(i)
TempArrayCounter += 1
End If
Next i
'Reassign the array
RecentFiles = TempArray
'Re-populate the menu.
mnuFileRecent1.Text = "1 " + RecentFiles(0)
mnuFileRecent2.Text = "2 " + RecentFiles(1)
mnuFileRecent3.Text = "3 " + RecentFiles(2)
mnuFileRecent4.Text = "4 " + RecentFiles(3)

End Sub

Private Sub frmRecent_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try

FileOpen(1, AppPath() + "Recent.dat", OpenMode.Input)
mnuFileRecent.MenuItems.Add(mnuFileRecent1)
mnuFileRecent.MenuItems.Add(mnuFileRecent2)
mnuFileRecent.MenuItems.Add(mnuFileRecent3)
mnuFileRecent.MenuItems.Add(mnuFileRecent4)

'AddHandler mnuFileRecent1.Click, AddressOf
Input(1, RecentFiles(0))
Input(1, RecentFiles(1))
Input(1, RecentFiles(2))
Input(1, RecentFiles(3))
FileClose(1)

Catch ex As Exception

End Try

Try

For I = 0 To 3
Select Case I
Case 0
mnuFileRecent1.Text = "1 " + RecentFiles(I)
Case 1
mnuFileRecent2.Text = "2 " + RecentFiles(I)
Case 2
mnuFileRecent3.Text = "3 " + RecentFiles(I)
Case 3
mnuFileRecent4.Text = "4 " + RecentFiles(I)
FileClose(1)
End Select
Next
Catch ex As Exception
End Try
FileClose(1)

End Sub

Private Sub frmRecent_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
'Write the contents of RecentFiles() to recent.dat
FileOpen(1, AppPath() + "Recent.dat", OpenMode.Output)
PrintLine(1, RecentFiles(0))
PrintLine(1, RecentFiles(1))
PrintLine(1, RecentFiles(2))
PrintLine(1, RecentFiles(3))
FileClose(1)

End Sub

Private Sub Recents_click()
mnuFileRecent1.PerformClick()
mnuFileRecent2.PerformClick()
mnuFileRecent3.PerformClick()
mnuFileRecent4.PerformClick()
End Sub
End Class



Regards and Thanks
Zeldacat

AnswerRe: addhandlers and addressofs Pin
Luc Pattyn13-Sep-07 15:05
sitebuilderLuc Pattyn13-Sep-07 15:05 
QuestionHelp me please ,assembly trust and \or security problem Pin
CodeMaster_0513-Sep-07 10:43
CodeMaster_0513-Sep-07 10:43 
AnswerRe: Help me please ,assembly trust and \or security problem Pin
Tom Deketelaere13-Sep-07 21:40
professionalTom Deketelaere13-Sep-07 21:40 
GeneralRe: Help me please ,assembly trust and \or security problem Pin
CodeMaster_0516-Sep-07 3:50
CodeMaster_0516-Sep-07 3:50 
QuestionDIRECTX audiovideoplayback Pin
plural13-Sep-07 9:54
plural13-Sep-07 9:54 
QuestionQuestion on VBScript Pin
T4AMD13-Sep-07 8:49
T4AMD13-Sep-07 8:49 
AnswerRe: Question on VBScript Pin
Dave Kreskowiak13-Sep-07 9:24
mveDave Kreskowiak13-Sep-07 9:24 
QuestionRe: Question on VBScript Pin
T4AMD13-Sep-07 10:28
T4AMD13-Sep-07 10:28 
AnswerRe: Question on VBScript Pin
Dave Kreskowiak13-Sep-07 10:42
mveDave Kreskowiak13-Sep-07 10:42 
QuestionSynchronising data from a client to a sql server database Pin
steve_rm13-Sep-07 8:46
steve_rm13-Sep-07 8:46 
AnswerRe: Synchronising data from a client to a sql server database Pin
Dave Kreskowiak13-Sep-07 9:21
mveDave Kreskowiak13-Sep-07 9:21 
QuestionWait for Shell script to finish Pin
New_Coder13-Sep-07 6:21
New_Coder13-Sep-07 6:21 
AnswerRe: Wait for Shell script to finish Pin
Dave Kreskowiak13-Sep-07 9:09
mveDave Kreskowiak13-Sep-07 9:09 
GeneralRe: Wait for Shell script to finish Pin
New_Coder13-Sep-07 12:06
New_Coder13-Sep-07 12:06 
GeneralRe: Wait for Shell script to finish Pin
MartyK200713-Sep-07 22:00
MartyK200713-Sep-07 22:00 
GeneralRe: Wait for Shell script to finish Pin
Dave Kreskowiak14-Sep-07 4:48
mveDave Kreskowiak14-Sep-07 4:48 
GeneralRe: Wait for Shell script to finish Pin
MartyK200714-Sep-07 4:51
MartyK200714-Sep-07 4:51 

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.