|
I was asking for more info so I could help, not telling you off. Why apologise and then start a new thread ?
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
I am writing data from a table onto a Excel file. But the problem i am facing is i am not able to print the file in a single page.
I would like to do change the page orientation to "Landscape" Make the Margins (Left and Right ) to 0 and etc...
All these thing i am doing using Visual Studion 2003 and building a Windows Application.
Can any one help me in doing that.
|
|
|
|
|
The aim is to divide a 30 character long integer by e.g. 987.
|
|
|
|
|
Considering there is no such thing as an Int128 structure, unless you've made one yourself, this is going to be quite difficult. Perhap's you should be looking for a Big Integer library. Google results for ".net big integer[^]".
But, there's an example of a large integer library here[^] on CP.
|
|
|
|
|
thanks,
everything is working with the biginteger-class.
|
|
|
|
|
I want to add a Value at the specified position of a file
please help me .
for example I have a file
hello
how are you
I want to change it to
Hello Master
How are you
tanks .
|
|
|
|
|
The problem with that is that files are not line based, so you can't change a line without changing every following line throughout the entire file. Additionaly, files are not even text based, so you can't determine where a line or a character is in the file without reading the file and decoding it into text.
For example, depending on the encoding, the character following "o" in "hello", may (for the most common encodings) be at the file position 5, 8 or 12, so you have to read the file up to that position to know exactly where it is.
There are basically two ways of doing what you want:
1. Read the entire file into a string. Make the changes to the string. Rewrite the entire file with the string.
2. Read the file as a binary file, decoding each character to find out the file position where you want to insert the data. Read the rest of the file into a buffer (byte array). Reposition the file at the desired position. Endcode your text and write it to the file, followed by the contents of the buffer.
So, either way you will be reading the entire file, and rewriting it at least from the point where you want to change it until the end of the file.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Holy hell - why would you do 2, one is such a simple method on a text file. I know there are circumstaces where the binary read is valid but surely not on a text file!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: why would you do 2, one is such a simple method on a text file.
I mostly descibed it for completeness. You would only need to do something like that if the file is too large to load it into memory. Then you would actually move the contents of the file piece by piece, as much as would fit in a reasonably sized buffer. If you have enough disk space, it would of course be simpler to copy the data to a new file, though.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Why not use the String.Replace function?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
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
|
|
|
|