|
you have the choice between the following :
MyComboBox.SelectedIndex = 2 'to select the 3rd item in the list
MyComboBox.SelectedItem = AnObject
MyComboBox.SelectedValue = AnotherObject
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I want to initial the value when loading a winform.
Actually , I do not know the Index of then combobox.
I only know the ID and the Name of the combobox item.
|
|
|
|
|
rushing wrote:
Actually , I do not know the Index of then combobox.
but how do you populate it ???
you fill it into the load event handler, then you know the indexes...
or i'm really out of your aim. is so, give a piece of code, otherwise i'll never can help you
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I think this code does your request.
ComboBox1.SelectedIndex = 2
The other properties can not be used as a target of assignment
Ex:
ComboBox1.SelectedValue.ToString() = "choice2" 'Items of ComboBox1 :choice1,choice2..etc..
-MCP& MCAD &junior coder--
|
|
|
|
|
hakanaktan wrote:
ComboBox1.SelectedValue.ToString()
are you sure you can assign a constant that comes from ToString() ???
i don't believe.
Moreover, ValueMember does not contain only strings...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Here what i wrote:
The other properties can not be used as a target of assignment
Ex: (example for the expression at the upperside)
ComboBox1.SelectedValue.ToString() = "choice2" 'Items of ComboBox1 :choice1,choice2..etc..
-MCP& MCAD &junior coder--
|
|
|
|
|
yes but, why don't you write
ComboBox1.SelectedValue = "choice2"
instead of
ComboBox1.SelectedValue<font color=red>.ToString()</font> = "choice2"
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I think it may be a bug of vs.net 2005 beta 1.
|
|
|
|
|
I hope this will help you
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Dim list As New ArrayList
With list
.Add("John")
.Add("James")
.Add("Jack")
.Add("Jimy")
.Add("Jombo")
.Add("Jimbo")
End With
End Sub
|
|
|
|
|
I use console.write("xxx") in my project.
But there is nothing in local output.
How to find the text?
vs.net 2005 beta 1.
|
|
|
|
|
The Output tab, although it's most common to use Trace.Write(xxx) to debug code.
|
|
|
|
|
There is some internal information in the output tab.
However, there is nothing about my output.
|
|
|
|
|
Console.Write() as its name says, writes into a cosole window.
the Visual Studio output window displays some debug informations, as it has been said to you already...
if you want to write text there anyway, replace your Console.Write() with Trace.Write()
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
The Trace.write() do not show text in output tab ,too.
|
|
|
|
|
|
There is only debug mode in vs.net 2005 beta 1.
|
|
|
|
|
don't know if you've solved this but use
debug.write("string")
then look in local
|
|
|
|
|
How do i pass a Class written in C++ into my VB project??
|
|
|
|
|
you must assure you that the class was not only written in C++ but in Managed C++ ! (unless you are not programming under VB .NET).
there, is the class encapsulated into a DLL or just into the exe ?
if it is in a DLL, did you think to add its reference in you project (and import its namespace if you like) ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
To import a excel file and display the records in spread sheet designer or data grid
|
|
|
|
|
Well I have done this using ADO recordset.. may this helps you
Dim sConn As String
Dim tmpRs as new Adodb.recordset
tmpRs.CursorLocation = ADODB.CursorLocationEnum.adUseClient
tmpRs.CursorType = 1
tmpRs.LockType = 1
sConn = "DRIVER=Microsoft Excel Driver (*.xls);" & "DBQ=" & txtPath.Text
tmpRs.Open("SELECT * FROM [" & cboSheetName.Text & "$]", sConn)
' txtPath is the path for the excel file....
' where cboSheetName.text is the sheetname within Excel file like sheet1
' or sheet2 etc
from here you have recordset and now you can do what ever you want...
|
|
|
|
|
hi, im just having trouble figuring out how 2 'print' or display text on a new line. i have ....
Text4.Text = "Tracing Route to " + Combo1.Text + ":" & vbCrLf & vbCrLf
and i need the stuff after 'combo.text1' : each to be displayed on the line beneath, as a list. any input would be MUCH appreciated!! thank u!
|
|
|
|
|
I guess you fotgot to change the property of a textbox... Multiline = true
just do this and your code is fine....
|
|
|
|
|
thank u VERY much !
|
|
|
|
|
How do you change a the sender's datasource (a datatable) from with a MouseDown event handler procedure.
I have a MouseDown event handler that needs to modify dataTables depending on who the sender is what their datasource is. How do you find out the dataSource of the sender and set a local datatable to that datasource. The datasource will always be a datatable.
Private Sub lstBox_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstUsedSoftware.MouseDown<br />
<br />
Dim dtRow As DataRow<br />
Dim index As Integer<br />
<br />
Dim lstBox as Listbox<br />
lstbox ctype(sender, ListBox)<br />
Dim dt as DataTable = ListBox.DataSource.GetType ?????<br />
<br />
<br />
If index > -1 Then<br />
lstBox.SetSelected(index, True)<br />
dtRow = dtUsedSoftware.Rows.Find(lstBox.SelectedValue)<br />
blha blah blah blah<br />
End If<br />
'End If<br />
End Sub
|
|
|
|