Ok. Firstly, apologies,' I didn't realize that this was web based. I am not a web person myself, but the following should work. I am sure some 'true' web people out there will come up with a more elegant solution for you. Firstly, radiobuttons do NOT cause a post back to the server by default, so you must enable this (AutoPostBack property to true) Then, you can key this code into your page_load event. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then ' ' normal code to initialise the form ' Else TextBox1.Enabled = RadioButton1.Checked End If End Sub
I am sure that you should be able to achieve the same results via some form of client side script, but as I said - I am not a web person, and the above code worked for me when I tested it !!
raph it
Posts
-
radiobutton and textbox -
radiobutton and textboxWhat exactly are you trying to achieve - all the code submitted in this thread works, so I suspect that you may be doing something out of the ordinary. Is a radio button the right control for you remembering that they are grouped. Perhaps a little more explanation of the task at hand may help in providing a solution that works for you.
-
print richtextboxSee if this MS knowledge base article helps .... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_RichTextBox.asp
-
radiobutton and textboxtry this. Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton14.CheckedChanged Dim rdoTemp As RadioButton = CType(sender, RadioButton) TextBox1.Enabled = rdoTemp.Checked End Sub
-
Accessing word CustomDocumentProperties from VB.NETHi. I have a VB.NET program that is creating Word documents based on an existing template file by filling in data retrieved from a database. Some of the content in the Word document is maintained in custom properties, however, although it is very easy to manage these from with a Word macro, I am having difficulty getting hold of the CustomDocumentProperties collection from within VB.NET. Originally, I tried having a variable of type Word.CustomProperty which I would use, in conjunction with the CustomDocumentProperties collection, but had absolutely no joy. Am I being stupid and missing something very obvious. The problem seems to be that for some reason, CustomDocumentProperties is of type System.__COMObject and does not have any discernable methods or properties. For now, I have created a single line word macro (as part of the original template) that simply sets a custom property to the value you desire, but this is far from ideal, and really goes against the grain for me!! Unfortunately, this is not a solution that can be entirely coded in Word as it is essentially a very small part of a bigger solution (the word doc is just something that is produced at the same time as other things) Does anyone have any experience with CustomDocumentProperties from VB.NET when talking to Office 2003. I prefer to use Option Strict On, but if it is necessary to turn it off, I will! A code snippet from .NET that I am using (simplyfied) is shown below. Any help with this would be greatly appreciated :-D
Imports Word = Microsoft.Office.Interop.Word .. .. .. Dim oWord As Word.ApplicationClass Dim docCurrent As Word.Document ' ' Start MS Word and open the document. ' oWord = CType(CreateObject("Word.Application"), Word.ApplicationClass) docCurrent = oWord.Documents.Open(FileName:="C:\MyOriginalDoc.doc", ReadOnly:=True) ' ' Since it seems impossible to get to the CustomDocumentProperties collection with the Word ' object Model through VB.NET, we run a little macro that is embedded in the template to ' populate the custom properties. Not nice, but apparently necessary - although I won't be ' defeated, so whatch this space! ' oWord.Run("SetDocProperty", "PhaseDescription", strPhaseDesc) ' ' And now we update the fields ' docCurrent.Fields.Update() oWord.Options.PrintFieldCodes = False d