Visual studio on click

Posted on 2008-11-02
Last Modified: 2013-11-26

I am just starting to use visual studio, can anyone give me an example of code that returns values to a list box on the click of a button. I'm not bothered what the values are just won't to see how its done?

Question by:ac_davis2002
  • 4
  • 3
LVL 13

Expert Comment

ID: 22861960

Author Comment

ID: 22861977
I will take a look, i am trying to use vB2005 do you have any examples using that?
LVL 13

Expert Comment

ID: 22861997
VB2005 with ASP.NET or desktop applications ?
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

LVL 13

Expert Comment

ID: 22862029
with you can do something like this
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="ListBox_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
    <asp:ListBox runat="server" ID="lstbxTest">
    <asp:TextBox runat="server" ID="txtTest"></asp:TextBox>
    <asp:Button runat="server" ID="btnAdd" Text="Add" />

==============CODE BEHIND=======================

Partial Class ListBox_Default
    Inherits System.Web.UI.Page

    Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        lstbxTest.Items.Add(New ListItem(txtTest.Text, txtTest.Text))

    End Sub
End Class


Author Comment

ID: 22862040
sorry I'm using windows applications

I really just want to see a command to populate a list box with values, do I need to use asp to do this?
LVL 13

Accepted Solution

sm394 earned 500 total points
ID: 22862072

drop a listbox and button control on windows form
then on click event of button
do this
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    End Sub

Author Closing Comment

ID: 31512503
cool thanks!!

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now