VS 2008 Enabling And Disabling Buttons?
Sep 11, 2009MessageBox.Show("Disabled")
Button1.Enabled = False
Button2.Enabled = True
[code].....
MessageBox.Show("Disabled")
Button1.Enabled = False
Button2.Enabled = True
[code].....
I have a program and I need the Submit time button to be disabled after I enter 5 numbers and then the Get Payment button needs to be enabled. I have been playing around for several hours but cannot figure out how to do it.[code]
View 4 Repliesi have this function to enable disable the controls on a form....
Private Sub EnableDisableAll(ByVal xType As Boolean)
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = xType
[Code]...
everything fine ...but when the controls r disabled it shows in the dull color. can i change the color ? as u can see i have given the command to change the forcolor to red to textbox but it still shows in dull greay... i dont want it to be enabled as i am using this to just give a view of records....the back color is changing to white but not the forecolor.....is there any thing more to be done...or any better way so as the items remain enabled but i dont allow the changes to be done.
I'm trying to make a program where when textbox1 doesn't have a value, textbox2 is disabled but when a value is entered to textbox1, textbox2 will be enabled.
View 13 Replieshow can i selectively disable propertygrid items, or even categories based on the value of another property? i read somewhere about a typedescriptor but i couldn't find a good example.
View 6 RepliesI am creating a USB "cookie dispenser" (long story) and I plan on programming it by, when cookie.exe starts, it disables the port, you plug the USB in and press a button and it enables the port (thus powering the device). What I need to know is, is this at all possible? And if so, can you help me get it to work? I know I should put in an effort but it's late for me (UK) and I want to post this overnight so that you guys (in the USA may
View 8 RepliesI am enrolled in a class in Visual Basic 2008. I wanted to drop the class, but it is too late. Now, I am stuck with this project that the professor assigned and it's due this Thursday. Anyway, how do I do this: The credit card number TextBox control is dynamically enabled/disabled depending on the choice of payment type? And did I do the newOrderButton correctly (see code below)? This is also the clear button. And is there a way to do a reset Form? Sorry for that many questions. I am really lost right now because there is a lot to do in this project and I don't even have a clue of how I am going to finish this project.
Private Sub newOrderButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles newOrderButton.Click
' clears all the information that is displayed and start over
[code]......
when I got home to try out the method in the above post in my real application things did not work out.The big difference is that my main form is a MDI. When I open my edit form, it's mdiparent is set to the main form. When I click 'edit' and then disable "me" the entire application goes modal.I was expecting only the MDI child to go disabled, not the whole application..Basically, I want only the MDI child window that opens it's "edit" dialog to go disabled..
View 1 RepliesHere lies my form: Attachment 72542 I have to perform save and show operations with the access database. If i select the Bank Account radiobutton(Radiobutton1) then Bank Account No. combobox is enabled,Credit Card No. combobox is disabled and user can input the value only in the Bank Account No. field. When the form loads then both the combobox1 and combobox2 are disabled and as the user selects the radiobutton the combobox are enabled accordingly. So i did the following code in the form load event:
[Code]...
I'm trying to enable/disable controls inside a repeater:
<asp:Repeater ID="Repeater1" OnItemCommand="RepeaterItemCommand" runat="server">
<HeaderTemplate>
<table>
<th>
[code]....
I'm working on a winform which contains several controls like textboxes, radio buttons, datagridviews... All of these controls have been added to a main group box called gbDataEntry. My problem is when the user is seeing the form, I set gbDataEntry.Enabled = False but I want to enable some controls like DataGridviews so the user can scroll them. After disabling gbDataGridview I set DataGridView1.Enabled = True but it seems that the datagridview does not respond to this line. Why?
View 1 RepliesI am developing an application with a DataGridView (dgvData) that requires a ToolStipMenuItem (tsmiSelectNetwork) of a ContextMenuStrip (cmsNetwork) to be enabled and disabled programmatically based on if the column is sorted or not.
I have set:
'tsmiSelectNetwork.Enabled = False' at runtime
'tsmiSelectNetwork.Text = Select All' at runtime
'dgvData.Columns(5).ContextMenuStrip = cmsNetwork' programmatically
When dgvData is sorted by column 5, tsmiSelectNetwork.Enabled should be set to True; when it is sorted by any other column, it should be set to False (see code below)
Private Sub dgvData_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvData.Sorted
If Not dgvData.SortedColumn Is Nothing Then
[Code]....
The debug output indicates it is functioning properly, but what you seen on the screen is not.
I am using Visual Studios 2008, version 9.0.30729.1 SP; and .NET Framework 3.5 SP1; ContextMenuStrip version 2.0.0.0
I have successfully ported a VB6 application to VB.NET (VS2008, .NET 2.0). Much optimization and rewriting has been done, but there is one possible BUG i cannot overcome. I have a standard HSCROLLBAR control used for accepting a numeric input. The control needs to be disabled during complex computational routines to prevent additional user input. I am setting the enabled property to false and reenabling the control at the end of the calculation cycle. The control is enabled and disabled a few times, because some code has been placed in the onpaint event of a drawing area, and separating the calculation part from the drawing part will be a huge task.
Large changes are handled correctly. Small changes aren't. The problem is that the control freezes in a unknown state after clicking on the arrows. A second click makes the control (and its parent control box) jump up and over everything else in their container.The scrollbar remains functional only via the contextual menu. This happens both in debug and release builds. There are no overrides. Coding/Test platform XP SP3 (more than 1 machine).
There is no code whatsoever that handles neither the parent control nor the scrollbar repositioning and resizing. The only code takes the value of the scrollbar and passes to the calculation section. If I omit disabling and reenabling the control, everything works fine.i tried rebuilding the control from scratch. forcing enabling the control after it has gone haywire does not make changes, disabling the groupbox instead of the single control doesn't make any difference, debugging step by step confirms that things go wrong when drawing the controls within the private system form classes.
I attached a picture of how my project should look and what the labels are. There are a total of 12 books and 4 different age groups. In each age group there are 3 books. There is also a previous and next books button which will show the next book in that age group. I want to make it so that previous button is disabled when it is on the first book of each age group and so that the next book button is disabled when it is at the last book. The only issue that I am having is that after the button is disabled it is not enabled again after. Here is my full code for this part as of now. As you can see I made it so that everytime I click on a new age group the previous button is disabled initially.
I took some unnecessary code out of here because I don't want anyone from my class finding this and coping all of my work.
Public Class BookInfoForm
' use this array to display information in this form
Private books(,) As BookInfo = getBooks()
[Code].....
I have a For Each loop going through the controls in a panel disabling them. When the loop reaches one certain grid control and disables it the CheckedChanged event fires for the next control in the loop which is a radio button.
The call stack is as follows:
System.Windows.Forms.dll!System.Windows.Forms.RadioButton.OnCheckedChanged(System.EventArgs e = {System.EventArgs}) + 0x15 bytes
System.Windows.Forms.dll!System.Windows.Forms.RadioButton.WnProc(Microsoft.AGL.Forms.WM wm = WM_RADIOBUTTON_NOTIFYVALUECHANGED, int wParam = 0, int lParam = 0) + 0x17 bytes
[Code]....
I don't understand how control.Enabled = False can cause the OnCheckedChanged event.
Just wondering how i can enable visual styles with the application framework option disabled - it would be nice to have the ability to use the xp+ theming while having a bit more flexibility
View 6 RepliesHow do I disable CTR+C in a richtextbox?
View 1 Repliesi need to get some buttons to interact with other buttons on screen when i click then, as each indivual button gives a slightly different result.imagine this:[code]....
then i need then to hide different buttons depending on which button was pressed. so say i pressed button 1 then all the buttons showed but alternativly if i had of pressed 2 then say button 5 and 6 disapear.managed to get one way to work but then i would only ever end up with the first results every time.
i did a program on VB 2008 Express Edition but id like to add a feature.Id like that my program could be only accessed if you had an internet conection and if i allowed it. Id like to disable my program whenever I like for the ones who have it cant use it if i dont enable it
View 20 RepliesIn my code i check listview1 values, whether they contain a "Yes" or a "No" if they contain a"No" i was trying to disable the checkbox on listview2 that corresponds to that value so far i have:
If formMain.ListView1.Items(Index).SubItems(2).Text = "No" Then
'// We need to disable all the checkboxes on listview2 that contain "No"
'// And also color code the background
[Code]....
Is it possible to disable ctrl+alt+delete in code? Can anyone post an example?
View 15 RepliesHow do I stop the user from typing into a combo box and only allow them choose from the options available?
View 2 RepliesI have this form with a bunch of input controls. I have code working that will disable them all like I want, but need to work with the if/then statement portion. Basically, it's a "History" form for patients. There's a date field for each entry, and if that date doesn't match the date you're accessing the form I want it to disable all controls so you can't edit the form. So it would have to check the current date with the date that is on the form. Then I also want to have an override button that will ask you if you want to enable all controls anyway, which I can probably figure out. There is some older VB6 code (I think) but I know nothing about VB6 or how it translates.
I think this is the portion that does what I want in VB6:
Private Sub DATE_DblClick(Cancel As Integer)
Call Setdate
Exit Sub
Dim sysDate As Date, Response
sysDate = VBA.Date
[Code] .....
How to have the program check the current date with the date in this form. From there it's probably just a simple if/then statement to fire off either sub. This date control on the form is a DateTimePicker. Maybe I just have to compare that to the system date but I still don't know what to call for that.
how can i disable the Home, End, and the arrow keys Next and Previous?All i need is having all those four keyboard keys disable while my application is running so the app do nothing if one of those is pressed.
View 4 RepliesIs it possible to prevent my program from being ran in Safe Mode and System Restored?
View 5 RepliesSo I need to disable to start menu and have found a code on a website but it doesn't seem to work. Heres the
Dim TFlag As Boolean
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (byval hWnd1 as Long, byval hWnd2 as Long, byval lpsz1 asstring, byval lpsz2 asstring as Long
Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
[code]....
Edit: I'm creating a program for places like schools or library where the password for all users are the same. I already made the program go to full screen and always on top and have disabled the user from using taskbar but I can't stop the start menu from appearing.
A program cant be exited thu Alt+F4
[Code]...
Edit2: I want it to be in the form so that the form cant be closed unless they press button with Close() command or task manager ends the process
I have a piece of software with two tabs, inside each tab there are buttons (the user can add the buttons when they want). when tab1 is full tab2 should start to fill. I currently know how many buttons fit on the screen so I just say something like if buttons > 150 then start to populate tab 2 The problem i have now though is if the resolution is changed then a different amount of buttons can be displayed. so if I put my screen to 1280x720 some buttons are left of. I was thinking of detecting the resolution and then using different cases for different resolutions but this seems very inefficient im wondering if there is a different way?
View 5 RepliesI am calling a login form from the base form. From the base form I disable it after i show the login form. Then from the login form I want to re-enable the base form that is disabled... I have set it to be enabled at the closing of the login form... doesn't work.. i have set it to be enabled through a collection and calling that base forms handle... doesn't work.. Anything that i might be overlooking?These forms are inside an MDI form..
View 15 RepliesSo how does one turn SSL on in System.Net.Sockets.TcpClient with VB.NET code?
Turning it on in System.Net.Mail.SmtpClient is easy, you set the .EnableSsl property. I cannot find a corresponding property in TcpClient. It's probably buried somewhere.