|
Hi, In Vb6 if I want to write a any program that working with an operating system (example: checking the memory status, size...) I have to work with windows api. If I work with vb.net 2003, what is the technique that I use to work with windows like vb6?
|
|
|
|
|
|
I have a deadline and I need some help!
1. Is there a way in VB that you can access the computer's default programs (i.e. Browser, E-Mail etc.), and if so, how do you access it to open it.
2. I have tried everything but a Marquee progress bar does not work. It justs sits there. The code I'm using is:
<br />
Private Sub Prog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
StatProgBar.Enabled = True<br />
StatProgBar.MarqueeAnimationSpeed = 70<br />
ProgressTimer.Enabled = True<br />
Run.Enabled = True<br />
<br />
End sub<br />
<br />
<br />
Private Sub ProgressTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressTimer.Tick<br />
StatProgBar.Value = StatProg.Value + 20<br />
If StatProgBar.Value = 100 Then<br />
StatProgBar.Value = 0<br />
End If<br />
<br />
End Sub<br />
It seems to have stopped working when I installed a new computer theme, but I don't know how this could effect it since I have seen other program's Marquee Progress Bars work fine with this theme.
Here is the theme that I have installed.
Any help would be extremely appreciated!!
|
|
|
|
|
The "default program" as you call it is tied the file extension of the file you're opening. When you double click a file, it checks the extension in the Registry, under HKEY_CLASSES_ROOT, and finds any Command values under the extensions key. That value shows the command line that's used to launch the application for that file.
To open any document or web page, all you ahve to do is start a new Process and pass it the full path to the file you want to open:
Dim proc As Process = Process.Start("C:\Documents and Settings\userid\folder\document.doc")
OR
Dim proc As Process = Process.Start("http://www.google.com")
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
UltraCoder wrote: 2. I have tried everything but a Marquee progress bar does not work. It justs sits there. The code I'm using is:
The Marquee style only works on Windows XP and above and only if you have EnableVisualStyles turned on in your application. It won't work at all on Window 2000 and below.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hey,
Is there a way to keep a form from closing? Example, if someone clicks on the close button in my program, I want the program to show a message box asking if they really want to close the program (I've got that), and then if they click no, then I want the program to stay open.
Is there a way to do this, I've seen it in other programs but I can't figure it out.
Please help! Thank you.
|
|
|
|
|
Check out the Form.Closing[^] event, complete with a sample of what you want to do.
Are you really sure you're an "Ultra" coder?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi
I need some help with this piece of code bellow.
I'm extracting pieces of information from Excel throug the following ADO connection.
This is a piece of VBA code implemented inside Access.
[code]Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Set con = New ADODB.Connection
With con
.CursorLocation = adUseClient
.Mode = adModeRead
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=E:\ExcelFileTool.xls" & _
";Extended Properties=""Excel 8.0;HDR=Yes"""
.Open
End With
Set rs = con.Execute("SELECT Site FROM [Clients$] WHERE Site = 'SiteOne'")
Debug.Print rs.Fields(0)
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing [/code]
This code is part of an Access Module and it's inside a loop process. The problem it's related with Excel processes are kept open in the memory.
I'll try to explain the best I can, and sorry about my bad english.
If I run this piece of code without the Excel file opened, everything runs Ok.
But when I run the code with the Excel file in question opened (and I need it opened for other reasons), every loop will increase the Excel process memory about 250KB plus (I see it in TaskManager), and there's more.
When the loop ended, even closing the opened Excel, the Excel Process keeps open on the TaskManager.
The 250KB increasing is very problematic because this macro will run thounsands of loops per day.
Thanks
P&V
|
|
|
|
|
I have a vb2005 logon.aspx page and i have on that page i have the standered System.web.UI.WeControls.login. what im trying to find out is how to dynamicly poition the control in the centre of the page
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
Hi, using VB net(2003) I have 2 questions. First how to change dynamically the property of textAlign in a textBox, see my ex: property of textAlign in the textBox1 is already set to the right, what I would like to do is when I change the value in that txtBox would be that data move to left, and after I finish then hit tab button on keyboard data move back to the right. My second question is how to set a value like zero 0 as a default in that same textBox only when that textBox is empty. Thank you in advance for your help.
|
|
|
|
|
You just need to capture the events: Enter and Leave
This code might help you:
<br />
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter<br />
Me.TextBox1.TextAlign = HorizontalAlignment.Left<br />
End Sub<br />
<br />
Private Sub TextBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Leave<br />
Me.TextBox1.TextAlign = HorizontalAlignment.Right<br />
End Sub<br />
If you are using this code many times, you might wanna implement this code in your custom textbox, so you wont have to repeat this code for every textbox you have in your form.
-- modified at 16:54 Friday 27th October, 2006
Dave Kreskowiak (Below) is very right, For your second question, capturing the TextChanged Event would fire the same event again.
If you explain a little bit more about what you are trying to do, maybe someone could give you the best way of doing it.
Alexei Rodriguez
|
|
|
|
|
you can use this:
Private Sub Textbox1_TextChanged(byval .....)
if Textbox1.Text = "" then
Textbox1.Text = "1"
End if
Regard,
Adrian
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
That won't work because it will continuously fire the TextChanged event. If you change the Text property in the TextChanged event handler, you have to take precautions to tell that your in the handler a second time.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Is there a way to print a form to a printer at runtime?
|
|
|
|
|
A little search on MSDN for "printing a form" reveals this[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
I have access to a program, in which all of the text editing is done through table fields.
However the Delete key doesnt delete text. Only the backspace key will delete text.
Also, Ctrl-C/CtrlV is spotty at best.
Any ideas as to what might cause this?
|
|
|
|
|
Is this an app you wrote or you're using??
You question sounds like it's one you're using, in which case the answer would be because the developer didn't add support for the Delete key, or removed it, depending on the control he/she used.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
It's an application I'm using, but I have access to the source code, so I can change it if I need to.
From the looks of it, the controls used are PropertyGrids and DataGrids.
|
|
|
|
|
Hi,
I'm fairly new to vb.net and I'm trying to declare a class that is a collection of another class.
I believe this is possible in c# using syntax like the following
public class myList : List<myItems>
I'd be very grateful if any one can tell me the answer, even if it is that you can't do it in VB.
It makes the code a lot easier if you can refer to the list within the class as "me."
, also I'd like to be able to refer to some of the data types I've declared in myItems within myList
Thanks
Sean
|
|
|
|
|
Public Class myList : Inherits List(of myItems)
Keep in mind the only thing you can now add to the collection is objects that are of type myItems.
Mike Lasseter
|
|
|
|
|
Thanks Mike,
greatly appreciated.
I'd tried inherits and : but not both together !
Sean
Sean
|
|
|
|
|
A colon is just a statement seperator. It has nothing to do with declaring a class or inheritance. You can do the exact same thing like this:
Public Class myList
Inherits List(Of myItems)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
i'm a new member here and was wondering if y'all can help me with this project i'm about to start? i want to write a program that will track phone call durations on a landline using either visual basic.net or VB6. i want to ask if this is possible and how to go about things.
thanks everybody.
kofiwusu
|
|
|
|
|
On a land line? This isn't Voice over IP. VOIP is a phone call made over an IP network.
If you're talking about a land line, how is the machine going to know that the phone was even picked up? Or are you talking about some other hardware setup?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|