|
AAGTHosting wrote: System.Data.DataRowView
is a type string, which is the default result of ToString() for many classes.
ToString() is called automatically by a lot of Controls to visualize an item
that is not a natural string.
Where is your data ("first and last name") coming from? an array? a list? a database?
why don't you show the relevant code?
clbTeachers.SelectedIndex isn't a string, so you can't apply a string-to-int conversion
to it. SelectedIndex is an index, hence an int; it does not need a conversion!
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
The data to fill the list box comes from a database. I use a data adapter to get the info from the database and then I fill a dataTable and get the info from the data table to the list box with the following code.
' fill the teachers checked list box<br />
clbTeachers.DataSource = dtTeach<br />
clbTeachers.DisplayMember = "teach_fname" ' & " " & "teach_lname"<br />
clbTeachers.ValueMember = "teach_id"
|
|
|
|
|
Hi,
a DisplayMember cannot be an arbitrary expression, it must be
"A String that specifies the name of a property or column in the data source specified in the DataSource property"
which means you may have to add a column to your database containing the first+last name
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Do you mean that I can't put multiple collumns from the data table or database in the display member property? Now, keep in mind, I still get the same error when I only populate the list box with the first name and comment the rest of the code.
I have been reading on the net about the specified cast is not valid error I am getting. It seems that this error is related to a check box. Do you think that this error may go away if I use a regular list box?
|
|
|
|
|
AAGTHosting wrote: Do you mean that I can't put multiple collumns from the data table or database in the display member property?
correct.
AAGTHosting wrote: Do you think that this error may go away if I use a regular list box?
correct. I haven't used this Control myself, but reading some documentation, I found
MSDN says "This property is not relevant for this class." for DataSource,
DisplayMember and ValueMember.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
In the database the teach_id is an int and the name is text.
|
|
|
|
|
I have an autocomplete textbox. When i press a certain key , it lists out several items.
But i have to scroll down the list to see all the items.What i want to know is that how can we increase the height of the listing?
Any idea guys?
|
|
|
|
|
Please don't crosspost. Are you using VB.NET or C# ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
Hi everyone,
I'm trying to nail down an elusive error. In a thread I have a Try/Catch around part of it. In the Catch block I do a CurrentThread.Abort() because if there is an error then the thread can just quit.
Every now and then I'm seeing a "Thread was being aborted." error in the error log. I haven't yet been able to get the error during debug.
My question is, could calling CurrentThread.Abort() in the Catch block be throwing the "Thread was being aborted." error?
If you have any ideas or any suggestions on how to terminate a thread on an error please let me know.
Thanks!
|
|
|
|
|
The JZ wrote: could calling CurrentThread.Abort() in the Catch block be throwing the "Thread was being aborted." error?
Yes, of course.
The Abort method is supposed to be called outside the thread, and it throws a ThreadAbortException exception in the thread to abort it. The thread is supposed to catch the exception as a signal that it has been aborted.
To end the thread, just do this:
Exit Sub
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
|
Guffa wrote: Exit Sub
Yes, but what if the decision is to be made in a nested function?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Good point. You can only exit a thread like that from the main method running the thread.
If you are in a nested function you can either return a value from the function to indicate that the thread should be exited, or throw an exception (other than ThreadAbortedException) that you catch in the main method.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I was afraid that was going to be the answer.
It would be easier having say Thread.CurrentThread.Exit(); but that
is not available...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I've put a sub main in my startup form, which I thought would be run on startup. But it doesn't seem to be. What am I doing wrong? Thanks
Public Class Form1
<stathread()> _
Shared Sub Main()
Console.WriteLine("MAIN SUB IS REACHED")
Try
Application.EnableVisualStyles()
Application.Run(New Form1())
Catch ex As Exception
Console.WriteLine("Main sub Error")
End Try
End Sub
End Class
|
|
|
|
|
Put the Sub Main in a module rather than a form.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
I am developing an Application where I have to export some data to an Excell sheet. For this I have to invoke the Excell application and send the data to the excell sheet.
Can anybody suggest how can I invoke the Excell Application form VB.Net 2005 and how can I send data after Invoking the excell application.
Thanks in advance.
Sekhar
|
|
|
|
|
Take a look into the Microsoft Office Interop Library.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
|
Hello All,
I have added one macro and while running the same, i am getting the error saying that 'Error HRESULT E_FAIL has been returned from a call to a COM component'.
Help plz..
Thanks in advance..
Sabari
Sabarinathan T, India.
The interests are to know something about everything and everything about something...
|
|
|
|
|
A macro in what ? What does it do ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
The purpose of the macro is to connect to the internet site.
Any idea?
Sabarinathan T, India.
The interests are to know something about everything and everything about something...
|
|
|
|
|
I still have no idea what sort of macro you're talking about, or how this relates to VB.NET programming.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I m sorry if my question was not relevent, In VS 2005, I have added my Block of code which will run as macro. The same is visible in the VS 2005 Macro-Explorer, But while running(Clicking on the Macro) only it has given the above mentioned Error.
Sabarinathan T, India.
The interests are to know something about everything and everything about something...
|
|
|
|