|
Because
Gadjuka wrote: Dim cls1 As New Class1
creates a new Class1, which has no bearing on the instance of Class1 that is running.
Also, why on earth are you still using VB6 ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Well...some of our customers still have old VB6 applications. Sooner or later we'll upgrade them to .NET, but it takes time...
I tried the same thing in .NET by the way. There I get "A property or indexer may not be passed as an out or ref parameter", so this particular problem doesn't seems to be solved by upgrading.
|
|
|
|
|
The status bar will contain only the text that is returned by the function - which will be "We're at number 10" since that is when the function call returns to the called procedure.
|
|
|
|
|
Hi Gadjuka,
I think the error message you got when you tried to do this in .Net answers the 'Why' your code doesn't work.
'I tried the same thing in .NET by the way. There I get "A property or indexer may not be passed as an out or ref parameter", so this particular problem doesn't seems to be solved by upgrading. '
So maybe the solution is pretty similar to what you already have. Try this:
<br />
Sub Command1_Click() <br />
Dim cls1 As New Class1 <br />
cls1.fnc1 StatusBar1<br />
end sub<br />
<br />
<br />
Function fnc1(ByRef sb As StatusBar) <br />
Dim i as Integer <br />
<br />
For i=0 To 10 <br />
sb.SimpleText = "We're at number " & i <br />
Next<br />
End Function<br />
<br />
You should be able to pass a reference of the control - I'm pretty sure I've done something along these lines way back when I was doing VB6. I didn't test this but I'm pretty sure it will work. Good luck!
The #1 Reply when developers programs don't work: "I thought I fixed that"
|
|
|
|
|
Yepp, that works.
Problem is that I wanted it to be a bit more flexible. To be able to get a log text out from the function whether you want to continuously track the function's progress in the statusbar or write the information to a file.
But I guess this way of doing it (sending in statusbar.simpletext) isn't possible...
I achieved what I wanted by sending in an ordinary string as ref and then have a timer that checks that variable and updates the statusbar.
|
|
|
|
|
So pass a flag along with your status bar control to indicate you want to write to the log file, the statusbar or both and write the code to handle the log file in your Class1 class. Then you could call it from your method. Just a thought.
Glad you got it to work in any case, I've rarely found cases where you couldn't find some kind of way to solve the problem. Of course that's why we're software developers - because we like that sort of thing. Cheers!
The #1 Reply when developers programs don't work: "I thought I fixed that"
|
|
|
|
|
hi
my problem is:-
I want when user enter a url of a web site in textbox and when he clicks a button then its HTML code gets append in a textbox.How to implement it?
I have searched google. but i didn't get the answer
please help me
note: i dont want to use web browser control for this purpose.
I M using vb.net 2005
|
|
|
|
|
Try this :-
Dim URL As String = "http://www.codeproject.com"<br />
Dim oWebClient As New System.Net.WebClient()<br />
Dim sHtml as String<br />
sHtml = New System.Text.UTF8Encoding().GetString(oWebClient.DownloadData(URL))
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
i am making a software on Invoice Management system.i have a problem on data report
because report big than a4 size (Invoice is preprinted one)
so my query is
can i increse size of paper more than a4 and less than a4
how i do it in vb.
|
|
|
|
|
vk,
set the settings of page setup.
rmshah
Developer
|
|
|
|
|
|
hi
I want to open multiple websites on a button click.
I M coding like this:
Private Sub btnOpenWebSite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenWebSite.Click
System.Diagnostics.Process.Start("http://www.rediff.com")
System.Diagnostics.Process.Start("http://www.codeproject.com")
End Sub
but the above code open the 2nd website ie. it open only one website at a time. please help me to open multiple websites on a button click
thanks
|
|
|
|
|
That's odd. Perhaps they both open the site in the same browser instance ? There's no other way to do it, unless you host the browser yourself.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
please tell me if there is any way to open them in different browser instance. As when I m Specifying the url it is opening on same browser instance
|
|
|
|
|
hi
thanks for your consideration. I have solved my problem. I m using web browser control and coading like this:
Private Sub btnOpenWebSite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenWebSite.Click
For i As Integer = 0 To 5
WebBrowser1.Navigate("http://www.codeproject.com", True)
Next
End Sub
|
|
|
|
|
Great - that's kind of what I was suggesting.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, hoping you can help. I am trying to add a restore button to the toolstrip on a form. How can i tell if the table adaptor or binding source row data has changed to enable the restore/do you want to save procedure i have set up. Thanks
|
|
|
|
|
I'm writing a program and have the following function:
<br />
Public Sub SetInfos(ByVal dir As DirectoryInfo)<br />
m_JBXInfo = dir.GetFiles("*.JBX")<br />
m_JBNInfo = dir.GetFiles("*.JBN")<br />
End Sub<br />
There is more to the function but it is with these lines that I'm having trouble. To test the function I changed one of the JBN file extensions to .JBNp to see if the function would still pull this file, which it shouldn't (at least that's what I thought) because the string pattern is *.JBN. However it still places the *.JBNp file into m_JBNInfo. However can I modify this sub to only pull files with the exact extensions of .JBX and .JBN and not something like .JBNp? Thanks in advance.
|
|
|
|
|
Hi,
this isn't a bug, MS calls it a feature.
Under some conditions there are wildcards prefixed and appended to the filter.
it has been hidden somewhere in the documentation but I don't have a pointer to it.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Anybody know a quick way around this?
|
|
|
|
|
Hello,
I've made an application starting by a splah screen (Created a form and set it as splash screen in the options)
I'd like to force it to display at first run and then let the choice to users to display it again or not.
(A checkbox with "Display splash screen at software start" and answer stored in the registry)
Of course it's easy to do it at design time but what about in the code itself before the software calls it at start...
Any idea how to include it in the code ?
Thanks to all
modified on Monday, April 21, 2008 12:34 PM
|
|
|
|
|
To do what you want, you will have to manually create/emulate the splash screen. You won't be able to use the Splash Screen setting for a VB project. To allow this functionality, you will have to create a sub main procedure which will handle the application execution.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I am using VB.NET 2008 Express edition and I have been trying to use the MonthCalendar control with no success. I am unable to change any color properties or any other properties as indicated in the Help files. Only the AddBoldedDate am I able to change, and then I have to go and find it to have it displayed. Does this MonthCalendar Control only have full operational capabilities with a full up edition of VB 2008, such as Visual Studio 2008 Professional, and maybe the Express edition doesn't have all of the properties enabled?
Thanks for any responses.
|
|
|
|
|
Every single VS2008 uses the same control set, which is the .NET framework. VS just has different versions to allow greater maneuverability when creating interfaces, but the main controls used are in the .NET framework. For example, in design-time using the forms editor, some features will be disabled in express but will be available in professional. A search similar to this[^] might be able to help you further.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hello
I am debugging an app written vb.NET2. The application attempts to connect to a FTP site to download text files. The error I keep getting, The remote server returned an error: (407) Proxy Authentication Required.
Code:
Dim prox As New WebProxy(ProxyAddress, PortNumber)<br />
prox.Credentials = New NetworkCredential(UserName, Password)<br />
Dim client As New WebClient<br />
client.Proxy = prox<br />
Dim rssStream As System.IO.Stream = client.OpenRead(FTPPath)<br />
Dim reader As New System.IO.StreamReader(rssStream)<br />
Dim xmlReader As New System.Xml.XmlTextReader(reader)<br />
Dim xmlDoc As New System.Xml.XmlDocument()<br />
xmlDoc.Load(xmlReader)<br />
'I then return the xml text
I also tried something like this
Dim web As New WebClient<br />
web.Proxy = New System.Net.WebProxy(ProxyAddress, PortNumber)<br />
web.Credentials = New System.Net.NetworkCredential(UserName, Password)<br />
Return web.DownloadString(FTPPath)
Any assistance would be greatly appreciated,
thanks
Kiefie
The man with a plan...Now where'd that plan go?
|
|
|
|