How do i make a custom control that has a collection like a listbox or combobox? When i define the property it automatically gives the option to open the collection editor in design view, but upon clicking add, it doesn't work. Error: Constructor on 'System.String' not found.
I have two listboxes and 4 buttons to move values from one list box to another listbox and remove items from second listbox.
I am getting values from datbase to the first listbox
btn1--> for to move all items from first listbox to second listbox
btn2--> to move selected items from first listbox to second listbox
btn3--> to remove selected items from second listbox
btn4--> to remove all items from second listbox
now everything is fine.. i completed all the task..
i have one more button to save second listbox values into database.
if i selected one by one and click save.. it works fine..
but if i selected all button and click save.. it does not save into database.
The code is as follows in btnsave_click
Dim cnt As Integer
Dim num As Integer
cnt = ListBox2.Items.Count
For num = 0 To cnt - 1
Dim cmdAdd As New SqlCommand
Dim insertAdd As String = "insert into JOB(JOBNO,PHASENO,USERS,BUILDNO,REVNO,REF,CUSTNAME) values (@JOBNO,@PHASENO,@USERS,@BUILDNO,@REVNO,@REF,@CUSTNAME)"
Dim sqlcmdAdd As New SqlCommand(insertAdd, con)
sqlcmdAdd.Parameters.Add(New SqlParameter("@JOBNO", SqlDbType.NChar, 20))
If TxtJobNo.Text <> "" Then
sqlcmdAdd.Parameters("@JOBNO").Value = Trim$(TxtJobNo.Text)
If CmbPhase.Text <> "" Then
sqlcmdAdd.Parameters.Add(New SqlParameter("@PHASENO", SqlDbType.NChar, 10))
sqlcmdAdd.Parameters("@PHASENO").Value = Trim$(CmbPhase.Text)
' sqlcmdAdd.Parameters("@PHASENO").Value = 0
' sqlcmdAdd.Parameters("@PHASENO").Value = CmbPhase.Items.ToString
There's several problems with this. You're creating a new SqlConnection and SqlCommand object, complete with parameters, on every line in your list. Don't. Create all the stuff first, outside the loop, then open the connection, reuse the command and parameters inside the loop, just filling in the parameters and calling .ExecuteNonQuery, NOT ExecuteReader! Close the connection after the Next in your loop and it's done.
i have a problem in combobox
i try to insert a value in bounded combobox.
when i write command
ComboBox1.DataSource = ds.Tables("test1")
ComboBox1.DisplayMember = "stor_id"
it does not display abc at top row.
and when i write that command after that
i display err message
Items collection cannot be modified when the DataSource property is set.
can i do it.
i have a problem with the AxMozillaBrowser NewWindow2 Event.
Now that's my Code:
Private Sub AxMozillaBrowser1_NewWindow2(ByVal sender As System.Object, ByVal e As AxMOZILLACONTROLLib.DWebBrowserEvents2_NewWindow2Event) Handles AxMozillaBrowser1.NewWindow2
Dim a As New Form
Dim ax As New AxMOZILLACONTROLLib.AxMozillaBrowser
ax.Dock = DockStyle.Fill
e.ppDisp = ax
The problem is, that it doesn't load the page. The window opened but then nothing else happened. What's wrong there or from where do i get the to opened url???
I Have Created a COM+ Serviced Based Application Dot Net
I have installed The Application Proxy In my Client machine when I access the COM+ Service in the Server I Get a error “ Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))”
Visual Studio provides different build scenarios. There are two build scenarios that are created when for a solution, Debug and Release. As the names suggest, the Debug configuration contains extra information inside the EXE or DLL to allow you to debug the application. The Release is stripped of all of the extra debugging information and is ready to be shipped or released.
i have a bounded combobox control on form in windows application, i tay to retrive selected value from it and try to show in a label control
but in label it not shows value,it shows system.datarow......
how i do it.
i write label1.text=combobox1.selectedItem
try to solve my problem.
The SelectedItem will return the DataRow object in the datasource that your box is bound to. Cast SelectedItem to a DataRow object, then you can use the DataRow's properties and methods to get the data you want out of that row.
Dim dr As DataRow = DirectCast(ComboBox1.SelectedItem, DataRow)
Dim id As Integer = dr("SomeIdColumnName")