|
Obvious, you write a bunch of code!
For such a generic question, I would suggest Googling for "Chess open source" projects. You'll find a bunch of them and you can even see the source code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here is the sample code:-
I was accidently add a line KeyAscii = 0 and then the Beep sound is off.
Question:
1) Why after add a KeyAscii = 0 and then the VB wont sound the Beep?
2) What causing the Error that VB sound the Beep?
Create 2 TextFields on your form. you are welcome to try.
Text1 = txtBegin
Text2 = txtEnd
//-- BEGIN Form1 --
Private Sub txtBegin_GotFocus()
txtEnd.Text = ""
End Sub
Private Sub txtBegin_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
txtEnd.SetFocus
txtEnd.Text = "Here"
'Without the following statement the Beep will sound.
KeyAscii = 0
End If
End Sub
Private Sub txtEnd_GotFocus()
txtBegin.Text = ""
End Sub
Private Sub txtEnd_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
txtBegin.SetFocus
txtBegin.Text = "Here"
KeyAscii = 0
End If
End Sub
//-- END Form1 --
David
|
|
|
|
|
It is normal for a single line textbox to beep, it indicates that the textbox does not accept an enter. Multiline textboxes do not beep.
When you intercept the keypress, you get to it before the beep has occured. The keyascii value stores the ascii value for the keypressed, this is 13 for the enter key. If you don't change it, then the normal windows behaviour will occur - it detects the keyascii 13 and beeps. If you change it to 0 (ascii null) then windows will not beep at you.
|
|
|
|
|
How to prevent from "Sub Script Out Of Range Error" while accessing an array of user defined type.
Type CL
H As String
V As String
End Type
Dim InsCL() As CL
If IsNull(InsCL) Then
'Redim Preserve...
End If
IsNull(InsCL) causes Error as
"Only User Defined Types defined in public object modules can be corrected to or from a variant or passed to late-bound function"
Shoaib Nawaz
|
|
|
|
|
Hey everybody,
I have the following script, and sometimes it works, sometimes it doesn't. Now it doesn't, and I can'at for the life of me figure out why. I've put the working and non-working versions side by side and there is no difference. The problem I'm running into is that it always redirects, usually (but not always?) without prompting for a user log-in.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
'get user name from login
strUser = Request.ServerVariables("LOGON_USER")
If strUser = Nothing Then
Response.Redirect("http://someplace/")
Else
'strip out domain + make lowercase
strUser = strUser.Remove(0, 11)
strUser = strUser.ToLower
'get full user name
GetUserName(strUser)
End If
End If
End Sub
I am trying to use Windows authentication. Here's what I believe to be the relevant snippets from my Web.config file, if that will do anyone any good:
<authentication mode="Windows" />
<allow users="*" />
Any help is greatly appreciated. Thanks in advance.
-------------------
abort, retry, fail?
-- modified at 14:56 Thursday 13th October, 2005
|
|
|
|
|
jszpila wrote: strUser = Request.ServerVariables("LOGON_USER")
Ummm... IIRC, this will always be the account that your site is using under IIS. This will NOT be the account that a web user is attempting to login to your site with.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yes I realise that, I probably should have explained better. But I tracked it down, it was an IIS configuration issue.
Thanks for your time, though!
-------------------
abort, retry, fail?
|
|
|
|
|
Does anyone have a VBScript with a message box or something for changing a computer name and joining a domain in Windows XP? Any help would be much appreciated. Thanks!
|
|
|
|
|
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
|
|
|
|