|
Hi,
Try seeking on the BinaryReader BaseStream instead of the FileStream. I haven't tested it but I think that's the way to go.
Alan.
|
|
|
|
|
Thanks for the reply,
The only seek I can find on the binary reader is the "br.BaseStream.Seek", which I assume is doing the fs.seek.
So confused on this one - lol.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Yes, it will be the FileStream, but it may be wrapped so that the BinaryReader buffer is invalidated when you seek. A direct seek on fs would not do that.
I'm not absolutely certain about this so do test it.
Alan
[EDIT] tested it myself in c#. There was no difference between seeking the basestream or the filestream and both methods moved the reader to the expected position in the stream.
modified on Monday, February 16, 2009 2:15 PM
|
|
|
|
|
I worked on some other projs and came back to this with fresh eyes. Here is what the VB6 binary reader is doing behind the scenes when reading integer values from binary. It's reading in 2 bytes (in this case UE displayed as BE and 02) and then reversing the values to get the decimal value.
02 BE = 702.
Incase anyone else is doing manual parsing of a binary file.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hello everyone,
Firstly i would like to thank those who have helped me with my earlier doubts thanks guys its because of u guys that dummies like me can even learn .NET application development....
Well this time i have come across to an issue regarding the famous office assistant that used to be present in the office release earlier Office XP....... What i would like to do is to get that assistant and include it in my own desktop application so that what ever help or tooltip the control will have or i would like to show can be displayed with the help of that assistant.....
Please guys help me out with this as i have gooled for this but failed!!
Thanks in advance
|
|
|
|
|
Google for "MS Agent", and you'll come across some samples. Kind of hard to find if you don't know the term "agent".
Most common agent is Merlin, some wizard-kinda-guy. It can do most the things that the Office-assistant does, including speech. The paperclip is for Office only, since it is associated with the product and copyrighted.
There's even a nice article[^] here on CP. Enjoy
I are troll
|
|
|
|
|
Heres a guy who REALLY hates his users
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thank you so much Eddy that really help me..... and i have created my application as well....... but during the course of the development of this application i have came across with another issue... i hope u don't mind me asking this but allowing the MS Agent to be visible and audible you need the *.acs file and TTS engine be installed in your machine, what i would like to do is to get those files automatically installed on the client's machine at the time of deployment and i would really appreciate if u please guide me the way to do this.......... moreover i would also like to do some other installation of other applications automatically along with my own application so how can i accomplish that..........
Your help will be highly appreciated....
thanks in advance....
|
|
|
|
|
There's an "msagent.exe" that installs all the required components, you can include this with most setup-packages. Check out the Microsoft Agent Home[^] site.
There's a link on the right, called "Licensing"[^] that contains instructions for licensing and installing.
You might also be interested in the Microsoft Agent Ring[^], a ring of websites that use Agent-technology.
Is your application available for download?
I are troll
|
|
|
|
|
I'm currently writing a program where I add a day to the current date and perform some analysis. The problem is I need to omit weekends. The current logic I am using is adddays(1), but this is giving me weekends.
Is there a simple way to just add weekdays to the current date?
Thanks.
George
|
|
|
|
|
Hi,
In c# my first try would be this
DateTime NextWorkingDay(DateTime today) {
int numdays = 1;
if (today.DayOfWeek == DayOfWeek.Friday) {
numdays = 3;
}
return today.AddDays(numdays);
}
Alan.
|
|
|
|
|
I want to Delete Duplicate records From a table except the Max(ID)
Using Full Text Query.
I am doing this in vb.net .
and
Duplicate records are just certain field
not an entire row in a table.
|
|
|
|
|
|
Isn't this the same question you asked Here?
I'm pretty sure the answers haven't changed over the weekend.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
how can i save PictureBox1.Image to bitmap file
|
|
|
|
|
hamziak wrote: how can i save PictureBox1.Image
maybe, PictureBox1.Image contains an image, maybe .NET has an Image class, and just maybe, such class has a Save() method, who knows?
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Maybe, just maybe, they might even get round to producing help files / documentation for these classes one day.
I have an idea, why don't we allocate the F1 key to do this sort of thing? I don't think it is being used for anything.
Oh, wait, how about this, what if you highlight something and then hit F1, the documentation would even open up the relevant page, now that would be good!
-------
yes, its lunchtime and i have nothing better to do!
Cheers,
|
|
|
|
|
The only problem with your suggestion, is that you are still reliant upon the user to have the ability to press F1
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
Hi,
How can give a full permission to a drive eg. (C:\ or D:\)? I used FileIOPermission to give permission to "C:\" but it didn't permit. I must be able to read, write, copy or move a directory or a file under the specific drive. The sample below doesn't work out. If you know how to do it, please let me know.
Thanks.
Dim FP As New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\")
Try
FP.Demand()
Catch ex As Exception
Beep()
messagebox.show("The permission denied!")
FP.Assert()
End Try
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
If the person running the code doesn't have the permissions you're trying to grant, you can't grant them!
The code you posted doesn't grant permissions to the user, but to the code, but only under the limits imposed by NTFS. Again, you don't have the permissions in the first place, you can't get them by using code.
|
|
|
|
|
The Situation
I have created a user control which is similar to a standard slider control but which has quite at few different features such as multiple slider pointers.
The control uses an image to visualise the slider strip background.
Private mySliderStripImage As Image = My.Resources.Horizontal_Slider___Basic_V1___Strip
To make the user control more flexible at design time, I've included a SliderStripImage property.
<Description("(As Image) The image to use for the Slider Strip.")> _
Property SliderStripImage() As Image
Get
SliderStripImage = mySliderStripImage
End Get
Set(ByVal value As Image)
mySliderStripImage = value
End Set
End Property
The control functions correctly, and when I'm working with the control at design time I can change the SliderStripImage property.
The Problem
If I change the SliderStripImage property to an image of a different size at design time, I have to manually resize the control to suit. That is, if I change to a larger image, I have to manually increase the size of the control in order to be able to see all of the new larger image.
I can get the dimensions of the new image with SliderStripImage.Width and SliderStripImage.Height , but how can I get the size of the control to update itself with these values at design time?
I thought I'd be able to do it with something along the lines of
Me.Size.Width = SliderStripImage.Width
Me.Size.Height = SliderStripImage.Height
But this doesn't work. I get the message "Expression is a value and therefore cannot be the target of an assignment."
Any advice greatly appreciated.
Paul
modified on Monday, February 16, 2009 4:38 AM
|
|
|
|
|
Well after a few more hours of banging my head against the keyboard I've managed to get a solution that works. But to be honest I don't fully understand why it works. Perhaps someone with a bit more knowledge could explain it?
While reading more about the System.Windows.Forms.UserControl class in the MSDN (http://msdn.microsoft.com/en-us/library/system.windows.forms.usercontrol.aspx[^]), I noticed the following lines in some example code:
' Size the user control.
Size = New System.Drawing.Size(375, 150)
So I modified my SliderStripImage property to
<Description("(As Image) The image to use for the Slider Strip.")> _
Property SliderStripImage() As Image
Get
SliderStripImage = mySliderStripImage
End Get
Set(ByVal value As Image)
mySliderStripImage = value
Size = New System.Drawing.Size(SliderStripImage.Width, SliderStripImage.Height)
End Set
End Property
This raises some questions:
1.Why haven't we had to specify what Size refers to with something like Me.Size?
2.Why are we creating a New object every time the property changes? Doesn't the control already exist?
Of course, nobody likes putting lines of code in their work that they don't understand themselves.
Can anyone shed some light on this?
Regards
Paul
|
|
|
|
|
1. In the MSDN example:
Public Class MyCustomerInfoUserControl
Inherits System.Windows.Forms.UserControl
MyCustomerInfoUserControl has a property Size inherited from UserControl hence any reference to Size in a method of of the MyCustomerInfoUserControl class does not need to be qualified. It refers to the property of the current instance.
2. The Size property is of type System.Drawing.Size. The new is creating a new instance of a System.Drawing.Size object not a new MyCustomerInfoUserControl control.
Regards
David R
|
|
|
|
|
Ah ha! Thanks for the lightbulb moment David!
1. This works in my code because my slider user control would also inherit from System.Windows.Forms.UserControl right? I'm using Visual Studio 2008 Express, and when I added a User Control, the template would have set up the inheritance in the hidden code. I didn't see it in the visible code which helped my confusion.
2. I think I get it. We're creating a new System.Drawing.Size object with the dimensions we want, and then setting the Size property of our existing System.Windows.Forms.UserControl to have the same Width and Height values as this new object.
|
|
|
|
|
As Julie Andrews sang "By George he's got it!"
That's what I think is happening.
Regards
David R
|
|
|
|