C# - Handle Many "yes/no If Yes <display Textbox>" On Form?

May 29, 2012

I'm creating a form in ASP.Net to replicate a paper form (I have no say in the design, I'm tasked with merely recreating it digitally). This form has many questions along the lines of "Answer yes or no. If yes, specify how much". I'm currently handling it by listing the question, and then having two radiobuttons in a group, one saying "yes" and one "no". To make this a little prettier, I've been using Ajax updatepanels that will only display a textbox to hold this yes value if the user selects Yes.Now I've been able to do this successfully, but each question is its own radiobutton group and has its own panel to update visibility, which means that the way I'm currently doing it there is a lot of redundant code like

[code]...

And so on for every question that has a yes/no option like that. I have no doubt there is a better way to do this. I was wondering if there is a way I could pass the panel associated with the radiobutton group so I could use a single method in the code that would fire for all radiobutton postbacks, something like (not real code)

[code]...

Or is there a better way to handle questions like this? I'm open to a different approach if it would cut down on the amount of redundant code that I'm typing now. I'm using VB, but I know C# so if someone is fluent in that with an answer I'd have no problem interpreting it.

View 1 Replies


ADVERTISEMENT

Display Queried Results In Textbox Where Criteria In Another Textbox 1 Form

Jun 21, 2010

I have a database I am creating with about 50 users over a network. There are about 6 groups of users and these users are spread across 10 branches. I want to block/allow users from particular forms and views. For example I want branch users forms to be filtered by their branch number but depending on the group they are in they can only see some forms. i.e. 50 users, 10 branches, each branch has about 5 ppl of where 1 is in group A and 4 are in group B. I want all users that belong to branch 1 to see the information they enter, but Group B enter data but cannot approved or delete, and group A can enter, approve and delete. So then. On my login form I have the user type his/her username but the i want LEAVE function to update 2 textbox where I have named GroupName and BranchNo. Basically to run a query and look for the username and return in one textbox that user's groupname and the other textbox the user's branch no. This information will be used to filter forms and block the user from certain controls. This is the code I have so far but still can't figure how to display the results.

Private Sub UsernameTextBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles UsernameTextBox.Leave
'Make Connection to database

[Code].....

It keeps highlighting the BranchNumber and UserGroup and giving error "Value of type 'String' cannot be converted to System.Data.OledbCommand

View 2 Replies

Display The Id Value Incremented By 1 In A Textbox In Form?

Jun 16, 2011

i want to display the id value incremented by 1 in a textbox in my form but getting error in the line cv = reader("id") + 1 my code is

Imports System.Data.SqlClient
Public Class Form1
Public connection As New Data.SqlClient.SqlConnection("Data Source=AMIT-

[Code].....

View 3 Replies

C# - Display Console.WriteLine Into Textbox On Form

Mar 7, 2011

Console.WriteLine("Network adapter: {0}", adapters[i].Name);
Console.WriteLine("Status: {0}", adapters[i].OperationalStatus.ToString());
Console.WriteLine("Interface: {0}",
adapters[i].NetworkInterfaceType.ToString());
[Code] .....
What I want is to have this Console.WriteLine displayed in a text box on the form but how to do it.

View 4 Replies

Display The Incoming Data On A Textbox On A Form?

Feb 9, 2011

I am receiving RS-232 data from serialPort1.Readbyte and want to display the incoming data on a textbox on a form. This causes a "...cross thread..." error.

View 4 Replies

How To Display Auto-generated Id On Textbox In A Form

Jun 8, 2011

knows how to display autogenerated id on textbox in a form?for exampleif i have 2 textboxes

1st txtbox is for CustomerID
and the other is CustomerName
when im gonna add a new record

[code].....

View 1 Replies

VS 2010 - Textbox In Form To Display Total

Mar 5, 2012

I have a text box in form1 that displays the total, I want to carry this over to form 2 into another text box as I navigate between them, how would I do this? Also I have a button on form2 to return to form1 but I need all the data that has been input by the end user to be cleared from both forms when returning, again how would this be completed?

View 8 Replies

Display Data From Database In A Form(in Textbox) After Listview_double Click

Jun 6, 2011

i'm doing a searching form, here is my code

Dim con As New OleDbConnection
Dim cmd As New OleDbCommand
Dim rd As OleDbDataReader

[Code]....

then after that i'm double click the 1 of the row in listview and 1 form popup with all data in database.

View 2 Replies

Creating A Program That Will Input A Number In A Textbox For Example 5 And Display 5 Textboxes In Form?

Sep 10, 2009

I'am creating a program that will input a number in a textbox for example 5 and display 5 textboxes in form...I have no idea how to do this but here is the code i've done..

textbox1.text = val(textbox1.text)

'i don't know what to do next..

View 1 Replies

Handle Different Display Font Sizes?

Nov 4, 2011

I have a basic VB.net app that displays a picture box with some text. nothing special. looks fine on my computer. If I display it on someone else's computer with a larger font size (125%?) my picturebox and text looks off and stupid.

How do people account for this? Should I simply get the new font size and multiple all positions, lengths and widths of object by 1.25?

I'd obviously like my dialog to scale properly and look as expected in any display no matter what font size is selected.

View 4 Replies

How To Handle Different Display Font Sizes

Nov 4, 2011

I have a basic VB.net app that displays a picture box with some text. nothing special.ooks fine on my computer. If I display it on someone else's computer with a larger font size (125%?) my picturebox and text looks off and stupid.

View 2 Replies

Display Control In .NET That Can Handle Color Codes?

Jun 12, 2011

It seems the only options available to do multi-color on a string is either a bunch of label controls cleverly grouped together or to use a RichTextBox and play with the font properties as text is added to the control.

What I am looking for instead is some kind of control that can render some style of control codes out as color. Consider bash codes:

NORMAL='e[0m'
GREEN='e[0;32m'
BLUE='e[0;34m'
echo -e "This text is ${GREEN}green${NORMAL} and this text is ${BLUE}blue${NORMAL}"

In the above, the words 'green' and 'blue' will be colorized with their respective colors. I was wondering if there was a control with some kind of feature like this, or will I have to code something myself?

Note, I only have the Express copy of VB 2010, and I would very much like to avoid third-party controls.

View 2 Replies

Display Of Datagrid Column: Can't Get It To Handle Carriage Returns

Sep 3, 2009

I am using Visual Studio 2005 and .NET 2.0 to display data pulled from a Oracle table. I am trying to display a notes column, but the column is not displaying the CRLF characters properly. The text is showing as a single line.

Private Sub BindNotesGrid()
Dim colRequestNotes As New BoundColumn()
Dim colCreatedBy As New BoundColumn()
Dim colCreatedDate As New BoundColumn()

[code]....

View 1 Replies

.net - One Method To Handle All Textbox Clicks?

Apr 20, 2011

Is there an alternative rather then doing this:

Private Sub clicktxtBox(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles _
txt_Time_00_000.Click, _
txt_Time_00_001.Click, _

[code]....

View 3 Replies

VS 2008 Using FindWindow To Get A Handle To A Textbox?

Mar 28, 2011

How would I use FindWindow to get the handle to a textbox on my form?

View 5 Replies

Handle Textbox Selection Start Property?

May 24, 2011

When i am assigning text in to textbox that time the selection start property is zero so the cursor(caret) is moving to first location of the textbox.

Code Sample

Consider that the textbox already have text like 'Hello Developers'
Dim CurPosition As Integer = TextBox1.SelectionStart
'CurPosition=11 (i.e) SelectionStart is 11 (cursor position)'

[Code]....

so when i am executing this code the cursor move up and down

View 1 Replies

Get Parent Form Handle In Child Form?

Sep 22, 2009

I am new to this. am wrting a program that uses the parent forms data...

but i am not able to access the parent object and use it with the client data [code]...

View 14 Replies

Raise Event In One Form And Handle It In Another Form?

Jul 13, 2009

I have two forms, "Customer Information Summary" and "Products Sold". They are shown as separate tabs in a MDI window. When the data in "Products Sold" gets updated, I would like an event to fire from that form which could be handled in the "Customer Information Summary" form.

View 1 Replies

Set Char Number Limit And Handle Special Chars In TextBox?

Jan 28, 2009

I am a new VB programmer and am using TextBox in VB2008. Here are the problems I experienced in TextBox -

1, After I typed number in TextBox and found I need to type another number. So I used backspace key to remove it. But at this time program quit and displayed this problem: InvalidCastException was unhandled. How to solve this issue?

2, Can anybody tell me how to set number of characters are allowed to be typed in TextBox?

3, Can anybody tell me how to implement the feature that only numbers are allowed to be typed? In case letters are typed, how to tell user to re-type?

View 5 Replies

Textbox Countdown That Will Display Text In A Textbox In Days?

Jul 21, 2009

I need code for a textbox countdown that will display text in a textbox in days.

View 13 Replies

Forms :: How To Handle Form Load

May 17, 2009

I had created a form(MDI Child) which have 3 to 4 dataset on it. They all are loaded from the database at the form load event and therefore takes too much time to load and show some part of form during that time. When it load completely it shows the whole form. Is there any way that user will see the complete form instead of some broken form.

View 4 Replies

Handle Form.MaximumBox.Click?

Aug 10, 2009

Is there a way to handle form.maximumbox.click in .net 1.1?

View 4 Replies

VS 2008 Handle Keypresses On The Form?

Feb 26, 2010

I have the following code to handle keypresses on the form:

Private Sub Form1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Debug.WriteLine(e.KeyCode)

[Code].....

The first time I press any of the arrow keys the code is not executed and a NumericUpDown(NUD) on the form gets the focus. The rest of the times the arrow keys are pressed everything is fine, until I click on a button. Then the problem repeats, focus NUD, then fine.

View 2 Replies

Timer - When The Message Box Stops, Then It Display The First Form Then Stop To Display?

Apr 8, 2011

I have a problem in timers, I want to display 2 forms each one after 3 and 5, how to do that? I mean when the first form appears, after 3 seconds another one will appear, then after 5 seconds the second will appear. I have a code where someone gave me here but its for message box only, thus I modify it to put a form still does not work. Here the code I put in the timer below:

Private Sub frmblabla_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
tmrnote.Start()
Private Sub tmrnote_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrnote.Tick[code]....

I still have problem when the message box stops, it displays all the forms together. All I want is when the message box stops, then it display the first form then stop to display the second then stop to display the last. The first form must stay for 3 seconds on the screen, then after 3 seconds the second appears then after 5 seconds the last appears.

View 2 Replies

Handle Event If Form Is Opened With A File?

Oct 4, 2011

Do you mean, "opens a file" or "is opened with a file"?

View 1 Replies

Use Form Handle In Class Without Pass It As Argument?

May 3, 2012

I'm writting a class that needs the form handle but there is a way to use it without send it as argument in the class constructor or in a property?I know that the handler is not set until the form is completely loaded so that is another problem too.The basic idea is catch the form handle without pass it as argument and handle the wm messages.

View 2 Replies

VB2010 Mechanism For Obtaining A Form's Handle?

Jun 7, 2011

What is the VB2010 mechanism for obtaining a form's handle?

View 1 Replies

VS 2010 - Get The Handle Of The Java Applet And Set It To An X And Y Co-ord On Form

Jan 29, 2011

Ok i'm loading a webpage in the WebBrowser Control, but what i need to do is manipulate that webpage. Here is the webpage (you will probably need to take a look so you know what i'm talking about). [URL] Now i'm trying to remove the advert at the top of the webpage OR somehow get the handle of the Java applet and set it to an x and y co-ord on my form.

View 2 Replies

VS 2010 Form Unable To Handle Other Events?

Apr 7, 2011

I'm trying to use a asynchronous UDP-Port to recieve data on a form.I manage to receive one message at a time(for each click of btnReadData), however if I do this receive in a loop (in order to continously receive new messages), my form seems to be locked.What am I doing wrong?

Public Class FPR2DIS
Delegate Sub dDataReceived(ByVal Data As String)
Dim UDPWorker As New Worker

[code].....

View 3 Replies

Winforms - Handle A Form Close Event?

Apr 27, 2011

I have used the below code but its not showing the msgbox. What is wrong with this code ?

Private Sub frmSimple_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
Dim result = MsgBox("Are you sure you want to Exit ?", vbYesNo)
If result = DialogResult.Yes Then
me.Close()
End If
End Sub

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved