|
Hmmm...
No still no luck! Doesn't like the .text after it.
Sometimes makes me think I should go back to VB6, haha. Was like my second lanugage!
This is the code for VB6, which works fine the only difference is that the 'i' was declare as a variant, but VB2005 wants it as a object, which didn't work so changed it to a Integer.
<br />
Dim i As Variant<br />
For i = 0 To ListBoxUpgrade.ListCount - 1<br />
If ListBoxUpgrade.Selected(i) Then<br />
LabelSum = LabelSum & Space(6) & ListBoxUpgrade.List(i, 3) & vbCrLf<br />
End If<br />
Next i
Do you have any more ideas or a better way to write the code??
Or go back to VB6... lol
Thanks,
Stefan.
"All answers have a question? All code has an end."
|
|
|
|
|
Dont go back to VB6, if anything show your current VB.NET code here.
And tell exactly what the current result is and what it should be.
|
|
|
|
|
The listbox contains objects which could be anything. ListBoxUpgrade.SelectedItem(i) will return whatever text the ToString method returns. For most objects this is the type of object it is. Because you've bound your listview you actually have a listview full of DataRowView objects. This is why the ToString method is returning System.Data.DataRowView. If you want to get the corresponding text of the item (the text being displayed in the listbox) you can use the GetItemText method.
For Each obj As Object In ListBox1.SelectedItems
Console.WriteLine(ListBox1.GetItemText(obj))
Next
|
|
|
|
|
Hi, that looks great. Never knew VB code could look so clean.
|
|
|
|
|
Excellent!
Thank you very much!
You would not believe the amount of books I have, and read that doesn't even state the 'GetItemText' method, Have only just made the transistion in VB2005 a few weeks now.
Great help!
Thanks again.
Stefan.
"All answers have a question? All code has an end."
|
|
|
|
|
That's what IntelliSense is for Also the MSDN library is a big help.
|
|
|
|
|
Hi all!
I'm sure there’s a commonly well known way to do this, but after days of googling and googling I can't seem to find a procedure.
I have an application the works with a SQL database, I want it to work with the data in a specific field, and then return that value to the database.
Where I'm stuck is that I can't figure out how to set a variable = to the data in a specific field.
Can someone please outline what I need to do, or point me to a specific tutorial?
Thanks for any help!
--Derek
|
|
|
|
|
instead of googling for days, spend a couple of hours reading some of the
excellent articles here on CodeProject (I am not saying they are all
excellent, but there are some bloody good ones !). There is a search facility
at the top of most pages on CodeProject.
|
|
|
|
|
I think you forgot something ...
finally { appropriateForum.Post(message); }
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
no no, finally block gets executed no matter what, and that is not required once
you found a solution somewhere.
Furthermore it would exceed the allowed 500 char maximum for a sig.
|
|
|
|
|
I realised the second I posted it. Shame, in english it sounds good. C# not so much.
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
Well, strickly speaking it shouldn't be finally but I had a geek attack. End of the day.
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
I appericate your reply, but I don't ask questions on formums unless I've done my research
|
|
|
|
|
Hi,
I did not intend to offend you, but so many questions seem to be asked because
asking looks simpler than searching...
I am not a database programmer (nor fluent in VB), this is a pattern (in C#) that
I encountered in many articles and discussions (I do read a lot of them):
for a DataSet ds the j-th field in row i can be accessed (read/written) by
ds.Tables["tableName"].Rows[i].ItemArray[j]
I am confident you know how to translate it to VB syntax.
I have never used it, but I do hope this helps. If not, maybe you should
post a new question, this time in the SQL/ADO.NET forum ...
|
|
|
|
|
Sorry, I didn't mean to be a jerk either, thanks for your help!
|
|
|
|
|
Hi,
I am new to this. I need some help with password recovery control. How do we use this?
I tried for some example but did not fine anything. Can some one give a small example how to send password through email?
Shirhit
|
|
|
|
|
Which bit are you stuck on ? The .NET framework has classes that make it easy to send email, and you would typically reset the password and send that, but you could get the existing one, if you needed to.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
There is an In-built class password recovery in asp.net2.0 version.
Are you using that one oe you have created your own?
Let all of us know where you have got the Problem so that only we can help you.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
I am using the built in Password recovery in asp.net. 1. Do I have to give the database connection in the page load or in the submit button?
2. How do you send an email to the user with new reset password?
|
|
|
|
|
I used the drag-a-data-source-to-the-screen method to build a data form.
When I click the X on the navigator toolstrip, it prompts me as in the following code,
but then it deletes the record anyway even if I choose No.
Debugging shows it never does the RemoveCurrent line when I choose No.
Can someone tell me what is happening? Is there an unseen method being called?
I can't find an e.Cancel to use like in other methods.
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
Me.Validate()
If MessageBox.Show("Are you sure you want to delete this employee?", _
"Employee", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.Yes Then
EmployeeBindingSource.RemoveCurrent()
End If
End Sub
Paul Watson wrote:
Like, if you say sort of, like, you know, one more, you know, time, I'm going to, like, you know, sort of sort you out, you know.
|
|
|
|
|
This might work if it has a handled function:
If MessageBox.Show("Are you sure you want to delete this employee?", _
"Employee", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = Windows.Forms.DialogResult.Yes Then
EmployeeBindingSource.RemoveCurrent()
else
e.handled = true
End If
Posted by The ANZAC : "WWBD, What Would Buffy Do?" : "I don't know man, she's stronger than me"
|
|
|
|
|
Thanks, but no such member exists for System.EventArgs.
Just Empty, Equals, GetHashcode, GetType, ReferenceEquals, and ToString.
I commented out my Remove line, and somewhere it is still being deleted. The table's Deleting and Deleted events are being fired.
The documentation for BindingNavigator states:
BindingNavigator.DeleteItem Property
When set, this property generates the Click event handler for the Delete button. This event handler calls the RemoveCurrent method when the Delete button is clicked at run time.
Paul Watson wrote:
Like, if you say sort of, like, you know, one more, you know, time, I'm going to, like, you know, sort of sort you out, you know.
|
|
|
|
|
After reading my last message, it dawned on me to set the DeleteItem property on the navigator to None.
The button click is still handled by me, so everything is fine now.
Paul Watson wrote:
Like, if you say sort of, like, you know, one more, you know, time, I'm going to, like, you know, sort of sort you out, you know.
|
|
|
|
|
I want to bring up the context menu when a choose a record from a listbox. By right clicking on the record but it does not select or highlight the record. How can I do this. I see where I can see a click event but not a rightclick event. If I can't how do I initiate the contextmenu without rightclicking.
Thanks.
|
|
|
|
|
IIRC there are CP articles on this. Use Search facilities !
|
|
|
|