|
Ashfield wrote: Why not use the String.Replace function?
Perhaps because it replaces text in a string, not in a file.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
True, but as you said in your ealier post, you have to read the file in some way before yuo can do anything to it. A text file is generally read into a string, hence the suggestion to use String.Replace
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ok, it looked like you were suggesting an alternative...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have a from with a tree view and a panel in which I insert user controls based on the selection from the tree. I need to call a function to cause the parent form to update a value displayed on that form? I tried to declare a public shared function and at that time, the vb control saw the function, however, in the function, it would not allow me to manipulate data on the form.
|
|
|
|
|
You should have the tree view raise an event, then the parent form can consume the event and do what ever is necessary.
|
|
|
|
|
I have no problem in getting the tree view events. I want to be able to call a global function from the forms that are created and display in the panel on the same form. The end result is to change a displayed value in the main form from a user control that is instantiated on the form.
|
|
|
|
|
Member 4009573 wrote: I want to be able to call a global function from the forms that are created and display in the panel on the same form. The end result is to change a displayed value in the main form from a user control that is instantiated on the form.
This alone defines a requirement that your user control should expose it's own custom event that the form subscribes to. Because VB.NET conforms to OOP far more closely, what you're describing isn't really possible without the usercontrol being specifically written to work with a certain form. This violates every OOP principle. The form is responsible for updating it's own controls. Controls should not be updating other child controls of the same, or other, forms.
|
|
|
|
|
Let's move away from trying to user a global function, generally this is bad practice, but I want to make sure I understand correctly. You have a tree view and a panel on your main form. I assume you want the panel to display a different user control when you select a different item in the tree view?
|
|
|
|
|
Yes, and that works successfully. Each item on the tree user control that is created on the panel. As I make choices on the user control. I need to provide feedback to display a value on the main form. I have a module that declares the global variables that each user control manipulates. This is my common interface between the main form and the user control.
|
|
|
|
|
If that's the case the user control should be raising the events. The main form should consume and update its display as necessary. You could create your own Custom EventArgs class that contains the information the main form needs and put this in the event. This would remove the need for the global variables which should be used sparingly. Does this help?
|
|
|
|
|
Thanks. I'll give it a try.
|
|
|
|
|
Hey everybody!
I want know if VB is a "true" general purpose language. In other words, is there something you can do in C++ or C# that you can't do in VB (while of course bounded to the .NET framework) ?
Thanks!
|
|
|
|
|
Anything you can do in C#, you can do in VB, except image processing and other pointer related stuff. Anything you do in C++, you can do in VB or C# via p/invoke, if need be, but C++ is likely to be faster.
So, I would not write a game in a .NET language, because speed matters. I would not write a simple data driven app in C++, b/c a C# app is quicker to write. I would not use VB only because I hate the syntax.
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 )
|
|
|
|
|
Thanks!
|
|
|
|
|
Green Fuze wrote:
I want know if VB is a "true" general purpose language.
Yes.
Green Fuze wrote: In other words, is there something you can do in C++ or C# that you can't do in VB (while of course bounded to the .NET framework) ?
Basically, no.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: Basically, no.
Well, except write a good 3D game, or do image processing
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 )
|
|
|
|
|
But you may write a bad 3D game and do some slow image processing, all in tune with VB developer usual skills: writing bad & slow software.
(just kidding)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I certainly won't claim to be as expert of a programmer as you 2 are. However,I have to disagree with you guys on at least 1 point. You can do fast image processing in vb.net but it requires you to use a simple work around just like you do in C# (getpixel setpixel sucks). I've used this work around myself on an ancient 700mhz laptop and its really fast. I've been meaning to write article about it for a while (I'll probably be submitting it soon).
I don't know alot about directX or opengl but since you typically call those functions for 3d graphics why would vb.net be bad for 3d graphics when it's not really the work horse.
|
|
|
|
|
MikeMarq wrote: I've been meaning to write article about it for a while (I'll probably be submitting it soon).
We will welcome it.
Don't bother about my sentences: just humour about average VB developers.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
MikeMarq wrote: You can do fast image processing in vb.net
You can access the pixels directly ? I thought you couldn't b/c of the lack of pointer access ?
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 )
|
|
|
|
|
If I am altering an existing file what I do is copy the contents of the file into an array. I do all my reading and writing of pixels in the array. Then I copy the array back into a memory stream and display the memory stream.
Your method with pointers is probably slightly faster since it doesn't require any copying but my method is fast enough that you can create/alter and display an entire image in less than a blink of an eye so the difference doesn't really matter.
I suspect setpixel/getpixel is so slow because it probably repeats the calculation of how many bytes per line every time it is called. In my system this only needs to be done once which saves a huge amount of processing time.
|
|
|
|
|
hello everyone.....
i have problem regarding read/write i.e. open and save file in menu editor.i m using vb6. so can anyone suggest me how to do that.i have used this code but its not working...n i dont know why...
Set oFso = CreateObject("Scripting.FileSystemObject")
sFilepath = cdg.Filename
oFso.CreateTextFile (sFilepath)
Set f = oFso.GetFile(sFilepath)
Set oTextStream = f.OpenAsTextStream(ForWriting, TristateUseDefault)
oTextStream.WriteLine "hello..."
regards,
pulkit joshi
|
|
|
|
|
It's not working because you are opening the file (when creating it), and then try to open it again without first closing it.
The CreateTextFile creates the file by opening it for writing, so you should take care of the text stream object that the method returns, and not try to open the file again.
Don't forget to close the stream when you are done writing to it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How to develop a tool in VB.net for comparing the two different file format documents (Like PDF , Word, Excel , HTML)
Please guide.
modified on Wednesday, May 14, 2008 4:30 AM
|
|
|
|
|
First step is to find the libraries you need to even read those formats. Next is to define what you're comparing ( for example, if the same numbers appear in a row in Word, in a table in HTML and in a sheet in Excel, does that mean they match ? )
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 )
|
|
|
|