|
Hi,
New here and on the hunt for some assistance (obviously).
First up I am a total virgin when it comes to code (asides from tsql), but I have a situation where I need to fill a combo box in an Access database with the users from our Active Directory.
Does anyone have any ideas/detail on how I can achieve this?
Thanks in advance
Troy
|
|
|
|
|
Is it possible to create a program in VB that:
1. Starts up an application
2. Runs checks every few seconds on the Windows task manager processes
3. If the program is still running, wait another few seconds
4. If the process is no longer running, go back to the .exe and restart it
5. Repeat
Also, it would need to have a custom input box to give the location of the program in case it changes. I'm not a very advanced programmer, and a complete noob when it comes to Windows programming, so this is why I ask.
I have some alpha server software to manage, and the server crashes often [every 15 mins or so] and it's getting quite a hassle to have to restart it manually. The bugs are being worked out, so fixing them right now is not an option, and this would make the deal a whole lot easier.
Thanks much, especially for tolerating a noob question like this lol
Ka-Wiz
|
|
|
|
|
Yes, that's possible.
I'm not sure how to check the task manager to see if the program is still running, but to start a process, you can just use Process.Start("C:\Directory\File.exe") . Then have a timer that checks if the file is still running, and use the same code to reopen it. Then create a text box to store the file path in.
|
|
|
|
|
I had a datagrid and button column in it the button type is push button but i need to change the button color(which is in cement color by creation) to red and also text color that is displayed on the button to blue
Is this possible?
-- modified at 16:29 Tuesday 28th November, 2006
|
|
|
|
|
"Do not post programming questions (use the programming forums for that)"
|
|
|
|
|
Please post your code.
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
|
I'm trying to create a screen saver using Visual Basic 2005. I've tried folowing a tutorial on the micorsoft site, however, whenever I try to compile it the program has numerous errors. I was wondering does anyone know of a good site or tutorial on this subject that explains from start to finish how to accomplish creating a simple screen saver? I'm newbie who is trying to learn by practicing and actually coding as I go. Also are there any how to learn visual basic 2005 books that anyone recommends for a beginner?
Thanks in advance
|
|
|
|
|
|
There is a Screen Saver starter kit included with VS2005
Pablo
Sometimes I think there's no reason to get out of bed . . . then I feel wet, and I realize there is.
|
|
|
|
|
But the explanations aren't very good.
|
|
|
|
|
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
|
|
|
|