473,785 Members | 2,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hepl! No accessible 'Main' method with an appropriate signature was found ...

Hello vb.net experts :)

I am trying to program an app that resides in the system tray and I am
trying to put all my main code in sub Main(). I am getting this
errormessage at compile:

Performing main compilation...
vbc : error BC30737: No accessible 'Main' method with an appropriate
signature was found in

I have done some post searching that has mentioned setting the project
properties entry point to sub main() and I have tried that with no
luck. I have tried placing my sub just about everywhere with hopes that
the error would go away. Right now it resides right under the "Windows
Form Designer generated code" section. Here is my sub, any help is
greatly appreciated.

Public Sub Main(ByVal cmdArgs() As String)
Dim RegEntry = GetNzbDirFromRe g()
Dim Verified = VerifyDir(RegEn try)

If Verified = False Then
MessageBox.Show ("Can not locate your config. Please make
sure the application is installed. Exiting.", "Blah",
MessageBoxButto ns.OK)
Application.Exi t()
End If
' GetPaths()
If ComPath.Length < 1 Then
MenuItem16.Enab led = False
End If
If InComPath.Lengt h < 1 Then
MenuItem17.Enab led = False
End If
foxCheck()
AddHandler t.Elapsed, AddressOf TimerFired
End Sub

Jan 22 '06 #1
9 23804
"Paulers" <Su*******@gmai l.com> schrieb:
I am trying to program an app that resides in the system tray and I am
trying to put all my main code in sub Main(). I am getting this
errormessage at compile:

Performing main compilation...
vbc : error BC30737: No accessible 'Main' method with an appropriate
signature was found in

I have done some post searching that has mentioned setting the project
properties entry point to sub main() and I have tried that with no
luck. I have tried placing my sub just about everywhere with hopes that
the error would go away. Right now it resides right under the "Windows
Form Designer generated code" section. Here is my sub, any help is
greatly appreciated.

Public Sub Main(ByVal cmdArgs() As String)

=> 'Public Shared Sub Main(...)'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Jan 22 '06 #2
Thank you for such a quick reply! I added the shared and I am now
getting more errors of a OOP nature.

Cannot refer to an instance member of a class from within a shared
method or shared member initializer without an explicit instance of the
class. I am searching for some posts regarding this topic but so far I
have not been able to get anything to work. here are some of my
functions it has a problem with.

Public Function SetNzbPath() As String
FolderBrowserDi alog1.Descripti on = "Please select the directory
containing SABnzbd.exe"
If FolderBrowserDi alog1.ShowDialo g() = DialogResult.OK Then
NZBfolder = FolderBrowserDi alog1.SelectedP ath
Return NZBfolder
End If
End Function

Public Function VerifyDir(ByVal NZBfolder) As Boolean
If Not System.IO.File. Exists(NZBfolde r + "\SABnzbd.i ni") Then
If Not System.IO.File. Exists(SetNzbPa th() + "\SABnzbd.i ni")
Then
Return False
Else
Return True
End If
End If
End Function

Public Function GetNzbDirFromRe g() As String
Dim regKey As RegistryKey
regKey = Registry.LocalM achine.OpenSubK ey("Software\Pa ulers
Software Works\", True)
Return regKey.GetValue ("NZBfolder" )
End Function

Jan 22 '06 #3
"Paulers" <Su*******@gmai l.com> schrieb:
Cannot refer to an instance member of a class from within a shared
method or shared member initializer without an explicit instance of the
class. I am searching for some posts regarding this topic but so far I
have not been able to get anything to work. here are some of my
functions it has a problem with.


Cut the code which is currently placed in your 'Sub Main' and add it to the
form's constructor right after the call to 'InitializeComp onent'. Then
either remove 'Sub Main' completely and set the form as startup object or
add the code below to 'Sub Main':

\\\
Application.Run (New MainForm())
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 22 '06 #4
Thanks so much for all your help. that seemed to do the trick however
there is one small issue. I am doing an Application.Exi t() and the
program skips passed it like it was not there. I also tried a me.Close
and the same thing happened. Are there any other ways to terminate the
application?

Jan 22 '06 #5
Thanks so much for all your help. that seemed to do the trick however
there is one small issue. I am doing an Application.Exi t() and the
program skips passed it like it was not there. I also tried a me.Close
and the same thing happened. Are there any other ways to terminate the
application?

Jan 22 '06 #6
"Paulers" <Su*******@gmai l.com> schrieb:
that seemed to do the trick however
there is one small issue. I am doing an Application.Exi t() and the
program skips passed it like it was not there. I also tried a me.Close
and the same thing happened. Are there any other ways to terminate the
application?


'Me.Close()' should be sufficient. 'Application.Ex itThread' should work
too. I suggest to set a breakpoint on the call to 'Me.Close()' and check if
it gets called. If this doesn't solve the problem, you could post relevant
parts of the source code.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 22 '06 #7
I set a breakpoint on me.close and the application did not break. Could
it be because I am trying to exit the application previous to the form
designer completing its work? Here is the code. Thanks!

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeCompo nent()
Dim regKey As RegistryKey
Dim ChosenPath As String
NotifyIcon1.Tex t = "WinSABnzb"
regKey = Registry.LocalM achine.OpenSubK ey("Software\Pa ulers
Software Works\", True)
If System.IO.File. Exists((Trim(re gKey.GetValue(" NZBfolder"))) +
"\SABnzbd.i ni") = False Then
FolderBrowserDi alog1.Descripti on = "Please select the
directory containing SABnzbd.exe"
If FolderBrowserDi alog1.ShowDialo g() = DialogResult.OK Then
ChosenPath = FolderBrowserDi alog1.SelectedP ath
End If
If System.IO.File. Exists(Trim(Cho senPath) & "\SABnzbd.i ni")
= False Then
MessageBox.Show ("WinSABnzb can not locate your
SABnzbd.ini. Please make sure SABnzbd is installedin the directory
specified. Exiting.", "About WinSABnzb", MessageBoxButto ns.OK)
Application.Exi t()
Me.Close()
Application.Exi tThread()
Else
NZBfolder = Trim(ChosenPath )
regKey.SetValue ("NZBfolder" , NZBfolder)
End If
Else
NZBfolder = Trim(regKey.Get Value("NZBfolde r"))
regKey.SetValue ("NZBfolder" , NZBfolder)
End If
GetPaths()
If ComPath.Length < 1 Then
MenuItem16.Enab led = False
End If
If InComPath.Lengt h < 1 Then
MenuItem17.Enab led = False
End If
foxCheck()
'Add any initialization after the InitializeCompo nent() call
AddHandler t.Elapsed, AddressOf TimerFired
t.Enabled = True
End Sub

Jan 22 '06 #8
"Paulers" <Su*******@gmai l.com> schrieb:
I set a breakpoint on me.close and the application did not break. Could
it be because I am trying to exit the application previous to the form
designer completing its work? Here is the code. Thanks!


I suggest to decouple startup code from the form code by moving it to 'Sub
Main':

\\\
If <did some startup stuff successfully> Then
Application.Run (New MainForm())
End If
///

You won't need to close any forms and the application will exit
automatically if startup was not successful.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 23 '06 #9
hi again Herfried,

I am in the process of moving my checks to main() and one thing I
noticed is the functions that I called previously do not work anymore.
they appear highlighted with the explicit error message that I
mentioned in previous posts "Cannot refer to an instance member of a
class from within a shared method or shared member initializer without
an explicit instance of the class." I also noticed that the variables I
had declared globaly (at the very top) are no longer visable. Can you
show me an example of how I would create an explicit instance of a
function? Thanks :)

Jan 23 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2104
by: opal7313 | last post by:
Hello, I have some difficulties to use phpMyAdmin on my ppc; I am working on panther 10.3.7 and php is already installed. I put phpMyAdmin directory in /Library/WebServer/Documents/ ; I adapted the config.inc.php of this application to have the good authorizations, the absolute uri... I check the httpd.conf to see if option to execute php were ok : apparently they were but.... when I tryied to open on a browser the url...
0
1090
by: Patrick L. Nolan | last post by:
We have a python+Tkinter program that works properly on Linux, but when moved to Windows (XP) it behaves in a strange way. There's a section like this: (child_out, child_in) = popen2.popen4(cmd) line = child_out.readline() while line: do_something_with(line) line = child_out.readline()
2
1807
by: Patrick L. Nolan | last post by:
We have an application that works on Linux. It has to be ported to Windows XP, and there's one bug that's driving me crazy. There's a number-crunching program written in C++. It is invoked by a Tkinter python script. The script uses the threading module to separate out the heavy processing. The worker thread uses popen4 to run the C++ program and capture its standard output. This output is sent to the master thread through a queue...
2
1871
by: Patrick L. Nolan | last post by:
I'm going nuts trying to port an application from Linux to Windows. We have a python/Tkinter script which runs a C++ application. It starts it with popen4 and communicates through the two pipes. It reads text output from stdout until a prompt appears, then sends commands through stdin. On Windows it seems to get all tangled up in the buffering of the two streams. When the script just reads stdout, it seems to be OK. As soon as the...
3
4298
by: Patrick L. Nolan | last post by:
Our python script uses popen to run an application on Windows XP. The application chokes if the filename given as a command line argument contains any spaces. It's happy with the 8.3 shortname notation, though. So given a file with a name like c:\Documents and Settings\Joe User\Desktop\My Files\foo.dat I would like to be able to convert this to c:\DOCUME~1\JOEUSE~1\Desktop\MYFILE~1\foo.dat This would be a fairly simple exercise in...
2
2856
by: Patrick L. Nolan | last post by:
I'm trying to find a clean way to launch a Wordpad editor on Windows. By "clean", I mean that it should work on as many versions of Windows as possible, and it shouldn't require installing any extra software. I assume everyone has win32api and its friends. The problem is to find the path to wordpad.exe. At first I just copied the path from my XP machine: c:\Program Files\Windows NT\Accessories\WORDPAD.EXE
4
5337
by: Patrick L. Nolan | last post by:
Our Tkinter application has a big ScrolledText widget which is a log of everything that happens. In order to prevent people from making changes, we have it in DISABLED mode except when the program wants to write a new entry. This works OK, except that sometimes we want to copy out of piece of the contents and paste it in another window. When it's DISABLED, it appears that we can't even select a portion of the text. Is this an...
5
2657
by: Dmitry Bond. | last post by:
Hello. Our product works fine on all 7.x and 8.x DB2 versions. But stops to work on DB2 v9.1. The main problem is - duplicate primary key (sqlcode=-803) happens when inserting records in QUEUE table. The primary key of QUEUE table is - 3 fields - QID CHAR(4), PRI INT and QTIME TIMESTAMP. When inserting records into QTIME table we are using the "CURRENT
0
1890
by: manjeet | last post by:
Hello everybody, I have a problum, i want to rewrite my file extention from .php to .html and also want to chang all the dynamic url into a static url. I have tryed the following option but that is not working. Please help me, i will be very thanksfull to that person Options +FollowSymLinks RewriteEngine on RedirectMatch permanent ^(.*)\.php$ $1.htm RemoveHandler .html .htm
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.