|
Both at the same time? Not recommended. Do one thing, reboot, then the other.
Rename a Computer and Computer Account[^]
Join a Computer to a Domain[^]
Notice that these examples are in the MS TechNet Script Repository? There's a large number of examples in there. I highly recommend browsing them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am having an issue with a VB .NET app, where one of my message boxes aren't displaying and you have to ALT+TAB to get it to display. I have been searching the web all day and found multiple times where the Virus Software was causing this due to OverFlow Protection being enabled, however the systems we are running this on don't have that enabled. Its only happening on this one form where we have 13 Message Boxes throughout it, and only this ONE MessageBox isn't being displayed.
Anyone have any thoughts?
|
|
|
|
|
Hi,
How can I disable the Windows Default Beep sound from VB. Instead of going to Sounds and Audio Device under Ctrl Panel to remove the Program Event sound.
Thanks,
David
|
|
|
|
|
This is NOT a good idea. You'll be disabling the sound for other applications too. Changing system wide settings without the users knowledge, or approval, is considered VERY BAD practice.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi all.
I'm new at this and I'm looking for critical comments (on style too) so I can do it better the next time. I designed the following code trying to incorporate as many lessons as possible.
Assumming my application consists of a main menu, a main toolstrip, and a main tabbed work area - I wanted an easy way to enable/disable main menu items or hide/display toolstrip button items --- depending on the current tab.
My first attempt was a spider web of if statements.
Then I decided on this approach - defining conditional (contextural) controls in a tabular fashion (getlistConditionalControls). Since some conditional controls may be disabled/hidden for several tabs, the 1st parameter is a bitwise sum of affected tabs. The 2nd parameter defines which property to affect (enabled or visible) - I would like to do away with this because I think I can test the referenced object (3rd parameter) for either ToolstripMenuItem or ToolstripButton. In my case all main menu items are enabled/disabled and toolstrip buttons are hidden/dislayed. Any help here? The last parameter is the alternate ToolTipText to inform the user as to why this control might be disabled (main menu items only).
Only conditional controls need to be listed here.
All comments and better ideas welcomed. Thanks
Public Class uxcMainFrm
Private ConditionalControlItems As New ArrayList ' List of Conditional Controls
Private Enum eProp As Integer
enabled = 0
visible = 1
End Enum
'
Private Sub uxcMainFrm_Load(....) Handles MyBase.Load
Call getlistConditionalControls() ' Define Conditional Controls
Call displayConditionalControls() ' Disable or Hide Controls Based on Cur Tab
End Sub
'
Private Sub uxcMainTabs_SelectedIndexChanged(....) Handles uxcMainTabs.SelectedIndexChanged
Call displayConditionalControls() ' Disable or Hide Controls Based on Cur Tab
End Sub
'
Private Sub getlistConditionalControls()
' Toolstrip Buttons
Call defineConditionalControl(6, eProp.visible, uxExpandBtn) ' Tabs #2 & #3
Call defineConditionalControl(3, eProp.visible, uxCollapseBtn) ' Tabs #1 & #2
' .... and so on
'
' Main Menu Items
Call defineConditionalControl(4, eProp.enabled, uxCreateMnuI, "To Enable: Select This or That")
Call defineConditionalControl(6, eProp.enabled, uxRotateMnuI, "To Enable: Select This or That")
' .... and so on
End Sub
Private Sub defineConditionalControl(ByVal tabs As Integer, _
ByVal prop As Boolean, ByRef control As ToolStripItem, ByVal altTooltip As String)
'
ConditionalControlItems.Add(New ConditionalControl(tabs, prop, control, altTooltip))
End Sub
Private Sub displayConditionalControls()
For Each ctrl As ConditionalControl In ConditionalControlItems
ctrl.setDisplay(2 ^ uxcMainTabs.SelectedIndex) ' Convert Base0 Tab# to Bit Flag
Next
End Sub
end class
'
Public Class ConditionalControl
Inherits ToolStripItem
'
Private _specTabs As Integer ' Specified Tabs to chk for - Bitwise enum
Private _Prop As Boolean ' Which Property (0=Enable 1=Visible)
Private _Control As ToolStripItem ' Control Name
Private _OrgTooltip As String ' Control Original TooltipText
Private _AltTooltip As String ' Control Alternate TooltipText
'
Public Sub New(ByVal specTabs As Integer, ByVal prop As Boolean, _
ByRef oControl As ToolStripItem, ByVal altTooltip As String)
'
Me._specTabs = specTabs
Me._Prop = prop
Me._Control = oControl
Me._AltTooltip = altTooltip
Me._OrgTooltip = Me._Control.ToolTipText
End Sub
'
Public Sub New(ByVal specTabs As Integer, ByVal prop As Boolean, _
ByRef oControl As ToolStripItem)
'
Me._specTabs = specTabs
Me._Prop = prop
Me._Control = oControl
Me._AltTooltip = ""
Me._OrgTooltip = Me._Control.ToolTipText
End Sub
'
Public Sub setDisplay(ByVal curTab As Integer)
Dim bVisible As Boolean = Me._Prop
'
If curTab And Me._specTabs Then
If bVisible Then
Me._Control.Visible = True
Else
Me._Control.Enabled = True
Me._Control.ToolTipText = Me._OrgTooltip
End If
Else
If bVisible Then
Me._Control.Visible = False
Else
Me._Control.Enabled = False
Me._Control.ToolTipText = Me._AltTooltip
End If
End If
End Sub
End Class
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
I am having a significant problem in handling multiple non-mdi windows forms. I am using Visual Studio .Net 2003 Visual Basic and .Net Framework 1.1sp1.
I wish to use the XP visual styles and it seems that the only way is to use
Application.EnableVisualStyles
Application.DoEvents()
Application.Run(specific form object)
in my Sub Main procedure.
The specific form opens but when I perform any action using a procedure within the form and reach the end of the procedure, the program leaves the opened form and returns to the command Application.Run(specific form object) in Sub Main. Is there a method to prevent the program from doing this until I specifically wish to leave the form and close it?
I have tested the program using Form.OpenDialog for all the forms I use (instead of Application.Run()) and this all works fine and I get what I want except I don’t get the XP visual styles look.
Any help would be appreciated.
jenkinsdjj
|
|
|
|
|
jenkinsdjj wrote: The specific form opens but when I perform any action using a procedure within the form and reach the end of the procedure, the program leaves the opened form and returns to the command Application.Run(specific form object) in Sub Main. .
This is exactly what's supposed to happen! Application.Run creates an instance of your startup form, starts the message pump for your application, then attaches the pump to your form's window handle. So long as the message pump is running, and the form it's attached to doesn't close, your application keeps running.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the reply. Each time I tried it the program would leave the form before it was formerly closed. After much searching I eventually found the culprit. It was an incorretcly initialized variable. VB .Net did not like it, did not throw an exception and and exhibited this perculiar behaviour.
Anyway problem solved. It is now working as it should.
jenkinsdjj
|
|
|
|
|
Hi all,
Not sure if my subject is correct in describing what I want to do. I have an integer variable (iOptions) where each bit represents an On/Off Flag:
0 = all off
1 = flag1
2 = flag2
4 = flag3
8 = flag4
....... and so on
Of course this integer variable could equal to 7 (flag1+flag2+flag3 are On) or anywhere in between.
How do I write a bitwise if statement to check if anyone flag is On?
if iFlag1 ?? iOptions then ' What goes here instead of ??
...
else if iFlag2 ?? iOptions then
...
end if
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
If I got it correctly you want to check a specific bit if is on or off.
Several ways.
Tha basic one is to OR the integer with the bit mask and check if the result is (or not) 0.
if (a OR 1) = 0 then bit0_notset else bit0_set
if (a OR 2) = 0 then bit1_notset else bit1_set
if (a OR 4) = 0 ...
Briga
|
|
|
|
|
Briga
Thanks so much! It's so simple, yet it is not discussed in any of the VB.Net books I have.
OR didn't work for me, but AND did.
Thanks again
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Sorry ... of course you're right is AND not OR!!!!
|
|
|
|
|
Sorry, of course you're right it's AND not OR (my mistake)!!!
|
|
|
|
|
Is there a way to control the sndrec32? I would like to be able to have it load a .wav, play it, save it as a .wav with different sample rate, etc..
any help would be appreciated.
|
|
|
|
|
Does anyone know the VB equivalent of going to the Mouse Properties in the Control Panel, changing the mouse schema, and saving/naming that schema?
i'd like to write a simple program that changes the mouse schema to one i made, and i got the setup to move the cursors to the right place, but i don't have any clue as to how to change things like this within windows from VB.NET
thanks for any help,
stephen
|
|
|
|
|
http://vbcity.com/forums/topic.asp?tid=70485RID205981
|
|
|
|
|
Hi Guys, Can anyone provide me with the best method to use for my new project: My new project must send data from a standard PC to a sql database on a web server then that data to be retrieved by a PDA, updated, then sent back to the sql database and then back to the standard PC again, I don’t know if I should use web services, sql synchronization or another method, The data that I will be sending will be XML, about 1 A4 sheet size, but I will be sending about 2 thousand per day.
|
|
|
|
|
|
How could i re-write this code more effective
i aim to do this
if number is 234 , result will be 234.00
if number is 1234 , result will be 1,234.00
if number is 1234.4 , result will be 1,234.40
if number is 1234.45 , result will be 1,234.45
if number is 1234.4522 , result will be 1,234.4522
if number is 1234.452284 , result will be 1,234.4523
Shared bNumberIsNegative As Boolean = False<br />
Public Shared Function SetComma(ByVal dblNumber As Double) As String<br />
Try<br />
If dblNumber < 0 Then bNumberIsNegative = True Else bNumberIsNegative = False<br />
dblNumber = Math.Abs(dblNumber)<br />
dblNumber = Math.Round(dblNumber, 4)<br />
Dim dblNumberWithOutComma As String = dblNumber.ToString<br />
Dim strNumberWithComma As String = ""<br />
Dim shrDotIndex As Short = dblNumberWithOutComma.IndexOf(".")<br />
Dim i As Integer<br />
Dim k As Integer<br />
If shrDotIndex = -1 Then shrDotIndex = dblNumberWithOutComma.Length<br />
For i = shrDotIndex - 1 To 0 Step -1<br />
k = shrDotIndex - 1 - i<br />
If (k Mod 3) = 0 And Not k = 0 Then strNumberWithComma = "," & strNumberWithComma<br />
strNumberWithComma = dblNumberWithOutComma.Chars(i) & strNumberWithComma<br />
Next<br />
strNumberWithComma &= dblNumberWithOutComma.Substring(shrDotIndex, dblNumberWithOutComma.Length - shrDotIndex)<br />
Select Case dblNumberWithOutComma.Length - shrDotIndex<br />
Case 0 : strNumberWithComma &= ".00"<br />
Case 2 : strNumberWithComma &= "0"<br />
End Select<br />
If bNumberIsNegative Then strNumberWithComma = "-" & strNumberWithComma<br />
Return strNumberWithComma<br />
Catch ex As Exception<br />
<br />
End Try<br />
End Function
-- modified at 7:45 Thursday 13th October, 2005
|
|
|
|
|
Try using the Format Function:
Format(myNumber, "#,##.00##")
Hope this helps
Tom
|
|
|
|
|
Hi,
I would like to know if it's possible to pass array variable to a VB DLL. I managed to create an ActiveX DLL on VB and convert it to Windows DLL by including a .def file to the VB linker.
I have no problem passing variable to the functions in the VB DLL. When comes to passing array to the subroutine, my program crashes. What I want to do is to have a subroutine in the DLL file to do some processes and update an array of variable (which I passed to it) with data so that EXE can make use of these array variables' data.
Below is one of a sub in the DLL file that I created,
****************************************
Public Sub WriteReport(OutputReportData() As Byte)
'Send data to the device.
Dim Count As Integer
Dim NumberOfBytesRead As Long
Dim NumberOfBytesToSend As Long
Dim NumberOfBytesWritten As Long
Dim ReadBuffer() As Byte
Dim SendBuffer() As Byte
'The SendBuffer array begins at 0, so subtract 1 from the number of bytes.
ReDim SendBuffer(Capabilities.OutputReportByteLength - 1)
'******************************************************************************
'WriteFile
'Sends a report to the device.
'Returns: success or failure.
'Requires: the handle returned by CreateFile and
'The output report byte length returned by HidP_GetCaps
'******************************************************************************
'The first byte is the Report ID
SendBuffer(0) = 0
'The next bytes are data
For Count = 1 To Capabilities.OutputReportByteLength - 1
SendBuffer(Count) = OutputReportData(Count - 1)
Next Count
NumberOfBytesWritten = 0
Result = WriteFile _
(HIDHandle, _
SendBuffer(0), _
CLng(Capabilities.OutputReportByteLength), _
NumberOfBytesWritten, _
0)
'Call DisplayResultOfAPICall("WriteFile")
'lstResults.AddItem " OutputReportByteLength = " & Capabilities.OutputReportByteLength
'lstResults.AddItem " NumberOfBytesWritten = " & NumberOfBytesWritten
'lstResults.AddItem " Report ID: " & SendBuffer(0)
'lstResults.AddItem " Report Data:"
'For Count = 1 To UBound(SendBuffer)
' lstResults.AddItem " " & Hex$(SendBuffer(Count))
'Next Count
End Sub***********************************************
The DLL crashed when it execute the following statement,
For Count = 1 To Capabilities.OutputReportByteLength - 1
SendBuffer(Count) = OutputReportData(Count - 1)
Next Count
It gives type mismatch. I believe the mismatch should be on the OutputReportData(). Of course on the EXE program declaration part, I declare OutputReportData by reference as follow,
Public Declare Sub WriteReport Lib "USBLib.dll" (ByRef OutputReportData As Byte)
I declared OutputReportData as public array,
Public OutputReportData(8) As Byte
On the calling sub statement side, I passed the OutputReportData array argument to the DLL subroutine as follow,
WriteReport OutputReportData(0)
Can someone please tell me what's wrong with my code? Thanks!
|
|
|
|
|
How i trap ok and cancel button value in inputbox function
himanshu
|
|
|
|
|
how to report the bugs together with program status such as procedure name, call stack, code line and variable contents
sanjay
|
|
|
|
|
read about exception handling. That class holds the info you are looking for.
|
|
|
|
|