|
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
|
|
|
|
|
i m wrote coding for searching files in my computer the code show the found file names in a listbox. but now i dont want to use list box i want to use datagrid i want to to add found files in datagrid
how can i do this??
what i have to do is as my code search files in my computer it shows the file matching my given extention and then after searching it show the list of the files in listbox i want to use datagrid instead of listbox
i m not gettin anything helpful
pls help!
purvas
modified on Monday, February 16, 2009 4:41 AM
|
|
|
|
|
You didn't mention VB6 last time. Is there a datagrid control in VB6 ? Either way, VB6 was always the domain of retards, and it's been unsupported for a long time. Why are you using it ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian.
Christian Graus wrote: VB6 was always the domain of retards
I think thats a bit harsh (its maybe true, nevertheless).
I for one still use VB6 (Not through choice now though), for systems such as industrial control, changing the frontend/backend systems tend not to happen very often, costs and fear probably drive this, i.e. if it ain't broke don't fix
We have a system that is still running NT4 with SQLServer 7 as the backend database for an alarm/event logger for 2 offshore platforms (average add 20K records a day, platforms 110miles from the server), i wrote a front end app in VB6 to support the operators accessing this environment (from Win2K machines & XP machines), why VB6? simple i could copy the exe file onto the client machines and it just worked, and didn't carry the risk of breaking any of the underlying system, if i wanted to add/change anything, just simply give them another exe.
Sometimes we are driven down a particular route because of corporate policy. Another example of this is, the standard office desktop environment only just got .Net V2 added a few months ago......Now they are in the progress of switching from Win2K to Vista (bet it won't have .Net 3.5 on it, haven't seen them yet to check)
Although, i don't think that this applies in the originators post on this occassion!
I will get down of my soapbox now......
Cheers,
|
|
|
|
|
I'm just dying to find out how many apps gets rushed into a conversion to VB6 when their owners find out that the VB6 runtimes are not supported under Windows 7.
|
|
|
|
|
Your Sentence is more than true, except one thing you should take care about.
Our company is still using SQL Server 2005 (2008 is now available), Win2k3 (Win2k8 is available), all our Work Station is XP SP2 (XP3 is there beside VISTA) and I can grantee to you that we can stay at this level of software versions for another 10 years.
I am sure this is the situation of lots of company around the world.
As a company, we don't purchase the last product in the market. we wait until the service pack is released. We cannot take chances and deals with bugs and error or our employee will not be working because of software bugs and that is reason #1 for most of the bosses are bold
Samir R. Ibrahim
|
|
|
|
|
Samir Ibrahim wrote: and I can grantee to you
Wow. That's ballsy. A computer guy who uses that term is taking an awfully big risk...
Support for XP isn't going to last that long. You won't get an more patches to close security holes and fix things long before that 10 year limit.
|
|
|
|
|
One more component is there similar to datagrid.
Name is MSFlexGrid Control.
This one is easy to handle.
code to add a content is
MSFlexGrid1.TextMatrix(Row Index,Col Index)= "content"
ex:- MSFlexGrid1.TextMatrix(0,0)= "Purvas".
|
|
|
|
|
There is Microsoft DataGrid Control 6.0 (SP5) (OLEDB) Activex available if you have VS6 + SP5
But using Datagrid, which is used to populate data from database source, so you have to save the found files you search in Access mdb and then display it in DataGrid.
Do you need to save the search result?
If no, I suggest using Listview.
Samir R. Ibrahim
|
|
|
|
|
Hi,
I am in need of a sound file
i would like to use in my multiplayer
card game application(Blackjack).
How do i go about it ?.I dont even have
any sound file at the moment.
akpakwu
|
|
|
|
|
Well, you can play mp3s with a media player control, you can play mp3s or wavs with DirectX.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
Hi to All,
Could anyone please tell me how to lock a particular data grid columns (from updating or editing by users) in vb.net2005.
Thanks in advance
I am a learner Always
|
|
|
|
|
|
|
try reading on how to ask questions here. 'pls help me' is a retarded subject, everyone wants help.
what part is the problem ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Don't delete your f-ing messages!!
|
|
|
|
|
i want user to enter only 0 to F in a textbox..
if the user enter except 0 to F, it will replace by 0..
that is what i have programmed..
but i got a problem where after the replacemnt with 0, the cursor indicator is go the starting, supppose the cursor indicator ddnt go anywhere unless the the user clicks at another option.
can u help me plss!!..thanks..
beginner VB user.
learning is lifetime.
|
|
|
|
|
Hi,
when will you start searching for the things you need, rather than just ask here?
one possible way uses keywords: KeyEventArgs, SuppressKeyPress
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
|
|
|
|