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

Visual Basic

 
GeneralRe: How to autostart up my vb application inside the system registry without "The specified RegistryKeyPermissionCheck value is invalid" Pin
jzonthemtn21-Jul-08 14:49
jzonthemtn21-Jul-08 14:49 
GeneralRe: How to autostart up my vb application inside the system registry without "The specified RegistryKeyPermissionCheck value is invalid" Pin
vbDigger'z21-Jul-08 15:22
vbDigger'z21-Jul-08 15:22 
GeneralRe: How to autostart up my vb application inside the system registry without "The specified RegistryKeyPermissionCheck value is invalid" Pin
vbDigger'z21-Jul-08 15:49
vbDigger'z21-Jul-08 15:49 
QuestionDeveloping EMail Proxy Server Pin
Jats_4ru20-Jul-08 19:20
Jats_4ru20-Jul-08 19:20 
GeneralSource Code in Visual Basic 6.0 for Webcam display for higher resolution cameras Pin
Clement Victor20-Jul-08 18:50
Clement Victor20-Jul-08 18:50 
GeneralRe: Source Code in Visual Basic 6.0 for Webcam display for higher resolution cameras Pin
Christian Graus20-Jul-08 19:27
protectorChristian Graus20-Jul-08 19:27 
GeneralRe: Source Code in Visual Basic 6.0 for Webcam display for higher resolution cameras Pin
Steven J Jowett21-Jul-08 7:19
Steven J Jowett21-Jul-08 7:19 
QuestionReflection, InvokeMethod, and Method 'Example.My.MyApplication.Main' not found. [modified] Pin
DanGetz20-Jul-08 18:43
DanGetz20-Jul-08 18:43 
We had a ASP.NET 1.1 Windows app that had the code below that I'm now trying to implement in ASP.NET 2.0 Windows app. The problem is that Main is "not found". The idea behind this is that it checks to see if the server has a new version and, if it does, it downloads it to the client computer and updates it. Can't figure out what I'm doing wrong... I get the error at the first Try / Catch at typeContent.InvokeMember. The error message is "Method 'Example.My.MyApplication.Main' not found."

The code is based off of the posting found at http://www.codeproject.com/KB/dotnet/DotNetBuildSmClnts.aspx[^]

Thanks,
Dan


Imports System.Reflection
Imports System.Security
Imports System.Security.Policy

Public Class Utility

Friend Shared Sub CheckForNewVersion()
Dim assemblyContent As System.Reflection.Assembly = Nothing
Dim strURL As String = "http://www.example.com/example/example.exe"

Try
assemblyContent = System.Reflection.Assembly.LoadFrom(strURL)

Dim Version As String
Version = Replace(assemblyContent.FullName, Microsoft.VisualBasic.Left(assemblyContent.FullName, assemblyContent.FullName.LastIndexOf("Version=")), "")
Version = Microsoft.VisualBasic.Left(Version, Version.LastIndexOf(", Culture="))
Version = Replace(Version, "Version=", "")

If My.Application.Info.Version.ToString <> Version Then
Dim typeContent As System.Type
typeContent = assemblyContent.EntryPoint.ReflectedType()

Try
typeContent.InvokeMember("Main", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.InvokeMethod Or BindingFlags.Static, Nothing, Nothing, Nothing)
Catch ex As Exception
SetSecurity(assemblyContent.Location.ToString)

Try
typeContent.InvokeMember("Main", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.InvokeMethod Or BindingFlags.Static, Nothing, Nothing, Nothing)
Catch exp As Exception
WriteToEventLog("Invoking Main(): " & exp.ToString, EventLogEntryType.Error)

'End
End Try

End Try

Try
System.IO.File.Delete(assemblyContent.Location.ToString)
Catch ex As Exception

End Try
End If
Catch ex As Exception

End Try
End Sub

Private Shared Sub SetSecurity(ByVal Location As String)
' Irrelevant code here
End Sub
End Class

modified on Monday, July 21, 2008 12:49 AM

QuestionGet current date from other pc Pin
klaydze20-Jul-08 16:35
klaydze20-Jul-08 16:35 
AnswerRe: Get current date from other pc Pin
Navneet Hegde21-Jul-08 0:06
Navneet Hegde21-Jul-08 0:06 
AnswerRe: Get current date from other pc Pin
jzonthemtn21-Jul-08 1:27
jzonthemtn21-Jul-08 1:27 
AnswerRe: Get current date from other pc Pin
Vimalsoft(Pty) Ltd21-Jul-08 3:50
professionalVimalsoft(Pty) Ltd21-Jul-08 3:50 
GeneralRe: Get current date from other pc Pin
klaydze21-Jul-08 14:52
klaydze21-Jul-08 14:52 
AnswerRe: Get current date from other pc Pin
Paul Conrad21-Jul-08 5:40
professionalPaul Conrad21-Jul-08 5:40 
QuestionCreateProcessWithLogonW and msi installer Pin
rogofreew20-Jul-08 12:26
rogofreew20-Jul-08 12:26 
AnswerRe: CreateProcessWithLogonW and msi installer Pin
Mycroft Holmes20-Jul-08 15:12
professionalMycroft Holmes20-Jul-08 15:12 
GeneralRe: CreateProcessWithLogonW and msi installer Pin
rogofreew20-Jul-08 20:18
rogofreew20-Jul-08 20:18 
GeneralRe: CreateProcessWithLogonW and msi installer Pin
rogofreew21-Jul-08 2:51
rogofreew21-Jul-08 2:51 
QuestionAll folders from the network Pin
Jodd20-Jul-08 7:10
Jodd20-Jul-08 7:10 
AnswerRe: All folders from the network Pin
Mycroft Holmes20-Jul-08 15:15
professionalMycroft Holmes20-Jul-08 15:15 
QuestionBindingsource.find is missing the first item.! Pin
MAP Tiger20-Jul-08 6:35
MAP Tiger20-Jul-08 6:35 
Questiondataset corrupt Pin
fazeepk20-Jul-08 5:45
fazeepk20-Jul-08 5:45 
AnswerRe: dataset corrupt Pin
Guffa20-Jul-08 6:16
Guffa20-Jul-08 6:16 
AnswerRe: dataset corrupt Pin
Vimalsoft(Pty) Ltd21-Jul-08 3:54
professionalVimalsoft(Pty) Ltd21-Jul-08 3:54 
QuestionQuestion : New Row Pin
zzsoulzz20-Jul-08 5:11
zzsoulzz20-Jul-08 5:11 

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.