|
That is the problem I had with the starter kit. They state you can change this and that but do not really explain how. Also I want to be able to build one using VS2005 from scratch which the starter kit does not explain. Unfortunately I have been unable to find a site or tutorial that does a good job explaining how to do it.
|
|
|
|
|
I can think of a couple cheap work-a rounds, but nothing that would be considered an actual Screen Saver.
I did read somewhere that all you have to do is change the filename of your .exe to a .src (screen saver extension), but that still doesn't explain how to create the visual effects.
|
|
|
|
|
I'm trying to read unallocated disk space -- leftovers from old file deletions -- by creating a new zero length file and dynamically expanding it. When I read the file contents during the process, I get nothing but nulls. Any ideas what's wrong?
Code snippet:
Dim oP as New FileStream ("C:\foo", FileMode.Create, FileAccess.ReadWrite)
oP.SetLength(1000000000)
oP.Close()
I get, as expected, a 10GB file. It consists entirely of nulls, rather than the bits and pieces of old deletions, as I'd expect.
What I'd ideally like to do is increment the file size by the hard disk cluster size, read the intervening data (generally 4K), lather-rinse-repeat until I've exhausted all disk space.
Any ideas how?
Wyman Miles
Senior Security Engineer
Cornell University
|
|
|
|
|
I think you have to do some lower level stuff, i.e. bypassing the File System
(and maybe VB is not the best friend to do that...)
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.
|
|
|
|
|
Being a security engineer, you should know that you're not going to get away with that. Any space that you allocate in the file is automatically zeroed out. That little trick was eliminated a LONG time ago!
You have to do low-level reads of disk sectors to get at erased information. You cannot use any of the File operations in the .NET Framework to do what you want.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You're right, and I should have realized that. I've done it before via AdjustTokenPrivileges followed by SetEndofFile/SetFileValidData.
When I try to grudgingly duplicate that in VB.NET, calling the requisite functions from kernel32 and advapi32, I get as far as AdjustTokenPrivileges before it errors with ERROR_INVALID_PARAMETER and I don't know why ...
|
|
|
|
|
I have a custom object that is accessible through a UserControl's properties. I have been able to use an ExpandableTypeConverter for the Custom Class to make the properties of this class show up in the UserControl's property grid. However, I cannot make it editable. No matter what values I give the properties through the grid, the values do not change from the default values given in the constructor. (Yes, it is initialized in the UserControl.) Most of the properties in this class are Colors and other custom types.
I would rather not have to adapt more properties in the UserControl just to make these editable. How can I accomplish this?
Thank you.
|
|
|
|
|
I'm writing a custom web component in VB and Javascript, using VS 2003. I originally wrote the same thing as a user component, but didn't like the big gray box it displayed in the designer. I'm going to use this component in a very populated webpage, and the big gray box would make it hard to align everything in the designer.
So now that I've almost finished the custom web component, when does it blosum into a component that looks like it will in the browser?
At the very least how do I control the width of the "[cwcComboBox "cwcComboBox]" thing to reflect the actual width of the component so I can place them where I need them in my web form?
Thank you.
|
|
|
|
|
You'd be better off asking this in the ASP.NET Forum.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok, I posted the question there too
|
|
|
|
|
vb.net:
using excel-file as database. usual using access-database, but in this case i want to fill data from a datagrid into a excel-sheet.
connection to excel-file and displaying its data in a datagrid works fine, but when i want to update it (see comment in code below), i get an error. i am updating my access-database the same way, never experienced problems there. please help.
<br />
<br />
Private conn As String <br />
Private DBCon As OleDbConnection<br />
Private DBDat As OleDbDataAdapter<br />
Private DBCom As OleDbCommandBuilder<br />
Private DatT As DataTable<br />
Private BMB As BindingManagerBase<br />
<br />
<br />
button1_click:<br />
conn = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source=" & Environment.CurrentDirectory & "\test.xls; Extended Properties=Excel 8.0;" <br />
Dim SQLString As String = "SELECT * FROM [sheet1$]" <br />
DBCon = New OleDbConnection(conn) <br />
DBDat = New OleDbDataAdapter(SQLString, DBCon) <br />
DBCom = New OleDbCommandBuilder(DBDat) <br />
DatT = New DataTable<br />
<br />
DBCon.Open()<br />
DBDat.Fill(DatT) <br />
DBCon.Close()<br />
<br />
BMB = Me.BindingContext(DatT)<br />
<br />
DataGrid1.DataSource = DatT<br />
<br />
TextBox1.DataBindings.Clear() <br />
TextBox1.DataBindings.Add("text", DatT, "F1") <br />
<br />
<br />
button2_click: 'here i want ot update my excel-sheet<br />
<br />
bmb.AddNew()<br />
TextBox1.Text = "test" <br />
bmb.EndCurrentEdit()<br />
<br />
'everything fine till here, but next line causes trouble:<br />
DBDat.Update(DatT)<br />
|
|
|
|
|
Without knowing what the error is, it's impossible to give you any kind of accurate advise.
But, the one GLARING problem you have is using the Environment.CurrentDirectory property to build a path. The current directory can change at any time and cannot be used reliably to specify the path to a file. Use Application.StartupPath instead. This will return the path to your .EXE file that was launched, every time. So, the code to build your path to the .XLS file might look something like this:
Dim connString As String = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;", _
Path.Combine(Application.StartupPath, "test.xls"))
Now, I don't do any Office interop or work with Excel files, but it might also be true that the TEST.XLS file must exist FIRST before you try to connect to it with your code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
the excel-file does already exist in my bin-directory and there is no problem connecting to that file and displaying its content in a datagrid.
also i don't think, that there's a problem with the "environment.currentdirectory"-part, since there was no change during loading the excel-sheet and trying to update it and it worls fine with access that way.
but i will try this. Thanks.
|
|
|
|
|
klappklapp wrote: since there was no change during loading the excel-sheet and trying to update it and it worls fine with access that way.
In your test environment, that's true. Out in the the "real world", that doesn't hold true. Unless you have special reason to do so, NEVER use CurrentDirectory as you don't have complete control over what the current directory is at any time.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Folks,
I want to encrypt a text box such that when someone enters there password - it does not show only '*' for each character entered.
Is there property?
What is an easy what to do this?
CiscoKid55
|
|
|
|
|
And what do you wanto to show, instead?
Crypted password?
I'm not sure, but this is not one of best practices (maybe unsafe...)
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.
|
|
|
|
|
When someone enters their password -
Password: George
I would want the screen to show
Password: ******
This would prevent anyone that happened to walk up from seeing their password.
Thanks for you help
CiscoKid55
|
|
|
|
|
Sorry, that wasn't clear to me...
The property is:
Password (TextBox class, VB.NET).
PasswordChar (TextBox control, VB6).
see MSDN for further details.
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.
|
|
|
|
|
Thanks - that was what I needed.
Have a great day!
CiscoKid55
|
|
|
|
|
|
Use a stored procedure and have it find you the max value of the primary key column and add 1 to it and then insert the record using the new value.
Declare @NextID int;
Select @NextID=(case when Max(ID) is null then 1 else Max(ID)+1 end) From Table1
Insert Into Tablel (TStamp,ID,...) values (GetDate(),@NextID,...)
|
|
|
|
|
Is it possible to have eg 8 threads in a Blocking status waiting for a multicasts from 8 different feeds.
Whats the best way of doing this. i have 8 different senders of UDP packet and i need to know when ech is transmitted and from what machine its coming from
|
|
|
|
|
1) setup 8 different listeners on 8 different ports. then there is no confusion on who's sending you the packet because each sender is assigned to his/her own port.
2) setup 1 listener and in the packet have some identifier of who's doing the sending or resolve the sender's ip address to know who it is.
i would opt for #2 unless there is a lot of traffic coming from each sender but obviously your call...
Nathan
|
|
|
|
|
Sounds good. but
1) Is it possible to have all 8 broadcasting on the same port?
2) Is it possible to get the IP address of the sender by reading the header of the UDP?
|
|
|
|
|
1) (hopefully I understand your question) yes each sender can send a packet to your program using the same port (1 listener) at the same time. there maybe some queuing involved but as along as the transaction isn't long, there will be notice of any delay.
2) the socket itself should give you the ip address of the sender. i believe there is an ariticle or 2 within codeproject.com that will give an example.
|
|
|
|