|
I am have problems adding records to an array. I am using a structure and an arraylist
Code Snippet
Public Persons As New ArrayList
Public Structure Person
Public First As String
Public Last As String
Public Home As String
Public Work As String
Public Mobile As String
End Structure
and the next block is to add a record to the list
Code Snippet
Dim p As New Person
p.First = txtFirst2.Text
p.Last = txtLast2.Text
p.Home = txtHome2.Text
p.Work = txtWork2.Text
p.Mobile = txtMobile2.Text
Persons.Add(p)
lstPhone.Items.Add(p.First + " " + p.Last)
The above code works but the trouble i'm having now is I cannot append to the array or save it.
Can anyone help?
Thanks all
Regards
Zeldacat
|
|
|
|
|
This code works just fine.
I'm not sure what type of control lstPhone is, but this below code will work just fine.
Question: Why are you using a Structure instead of a class?
Question: Why are you using an ArrayList instead of a Generic List(Of Person)? This would provide a type safe collection.
Public Structure Person
Public First As String
Public Last As String
Public Home As String
Public Work As String
Public Mobile As String
End Structure
Public Class Class1
Public Persons As New ArrayList
Public Sub New()
Dim p As New Person
p.First = "hello"
p.Last = "There"
p.Home = "555-1212"
p.Work = "411"
p.Mobile = "900-555-1212"
Persons.Add(p)
' this will work just fine
'I'm assuming that lstPhone is a Combo Box or List Box?
'lstPhone.Items.Add(p.First + " " + p.Last)
End Sub
End Class
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Sorry Karl I made a bit of a boo boo here.
I forgot to add the fact, i'm using a .csv file to append the new persons data to. I might get a thread going properly one day.
Regards
Zeldacat
|
|
|
|
|
Cedrickdeorange wrote: I forgot to add the fact, i'm using a .csv file to append the new persons data to.
How does this change anything?
You can read your .csv file, record by record and still load a Generic Collection List(Of Person).
Am I missing something?
modified 27-Feb-21 21:01pm.
|
|
|
|
|
No. I know where you're going with this now.
I had another look at the first post again. I wasn't thinking that way at the time. As i said it all makes sense now.
Thanks.
Regards
Zeldacat
|
|
|
|
|
hai to all,
I am new to Vb.Net Windows Application How To Load The Menu Dynamically In Vb.Net.
|
|
|
|
|
Are you programming in WinForms, WPF or ASP.NET?
modified 27-Feb-21 21:01pm.
|
|
|
|
|
The quick answer for all situations, loop through your data, and create the menu accordingly.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I am from Afghanistan and I am developing an application for bank. my application has connectiviy with sql server.
i have a problem that i can write farsi (persian) in textboxes and it is saved in sql server database file like ??????.
I would really appreciate if any one could help me plz.
|
|
|
|
|
Check your fields are nvarchar, not varchar, to support unicode.
|
|
|
|
|
Hi Abdul
I had some experience working with Arabic in VB6. May be it will help u.
First u have to add Farsi as a language option in ur OS it is done by regional settings in control panel.
In the DB u have to enable unicode option and have a unicode connection to the DB not a ANSI one
Hop things will work by this.
For references u can download free examples (There is something named as 100 code sample) from MSDN site. In that set of examples there is one multilingual sample is given.
Good Luck
|
|
|
|
|
Hi
I am writing a custom webbrowser for my company and we need to snapshot html in the webbrowser control. Some pages are frames etc and I've tried saving it off, but I sometimes only get one frame. Is there a way to grab the main body of text, but am guessing "how can you tell whats the main body!"
Really confused on how to do this. Its gotta be "one click, save to disc", no user interaction (they get confused!)
Is it poss also to save the html from the webbrowser in to something else, like pdf or somthing? Is this an easy way round this?
thanks so much for reading really grateful for any responses
kee
|
|
|
|
|
Have a close look at these properties on your webbrowser control. They expose the information you need in several different ways.
Document
DocumentStream
DocumentText
You can get everthing your looking for.
Frames add a level of complexity, but you can still get your document and frames.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
|
hi all,
i want to create a Mpeg file using different jpeg file. i alredy try google and other, but not get any proper way to complete this task.
anybody have idea that how can i do this task in vb.net ?
Please provide some guidance or code of snippet or link
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
there is an example on codeproject, it's done in C#, but you should be able to convert it with a conversion to vb.net tool, the link is http://www.codeproject.com/KB/graphics/MPEGFunction.aspx[^]
<font color="blue">Csharp</font> me = (<font color="blue">Csharp</font>)Dynamic_Sysop; <font color="#008000">// My Signature.</font><br><font color="#008000">$twins</font> = <font color="#008000">me.twins</font>(<font color="#800080">"Taylor"</font> , <font color="#800080">"Delta"</font>); <font color="#C0C0C0">// My twin daughters.</font><br>echo <font color="#008000">$twins</font>;</br></br>
|
|
|
|
|
Hello every one
I had a VB6 application which we migrated to VB.net 2005 Express
Now after removing all the other VB6 dependent components we are left with
“Microsoft ActiveX Data Object” which is ADODB.dll.
I was using a ODBC connection, was having a DNS
Can any one tell me the most which type of “.net” connection I use so that there is not much change in the code (I have centralized connection and record set), where all I am doing a database operation
If some one knows about a link plz do let me know
I tried using Npgsql i am getting following error
Failed to create component 'NpgsqlConnection'. The error message follows:
'System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.
File name: 'Mono.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'
at Npgsql.NpgsqlConnection..ctor(String ConnectionString)
at Npgsql.NpgsqlConnection..ctor() in c:\Desenvolvimento\Npgsql1.0-src\Npgsql\src\Npgsql\NpgsqlConnection.cs:line 116
WRN: Assembly binding logging is turned OFF.
Can any one plz help me
Regards
Nishkarsh
modified on Saturday, February 02, 2008 6:59:00 AM
|
|
|
|
|
I would recommend OLEDB and have found this site to be very usefull for connection string examples
Clickety/[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
HI
Thanks for ur reply
I think it will be good idea if I explain my situation clearly.
The application is designed to access a centralized DB server and all the clients will have there own copy of the application
In my Vb6 application I was able to connect to the DB using ADODB connection and ODBC data source / DSN, this gave me freedom that no matter where the DB server is located I can just configure the DSN in each client machine and the application will work
Now when I want to do the same with .Net I am not able to do the same.
I had tried using Npgsql and Data.OleDb.OleDbConnection
But I am not able to succeed
Can u plz give me an idea how to do it, any sample or reference if possible?
Regards
Nishkarsh
|
|
|
|
|
I want to create a package which captures the print command given by the user ie how much page is given for printing,which PC has given the print command,wheather it is color or black and white etc.if anybody knows it plz let me know,thank you.
coolsatty
|
|
|
|
|
|
Dear All...!
Is there anybody know, how to make the form that cover all windows feature such as start buttom, tray and windows tab.....?
Thank you
Best Regards,
Ahmad Rifai Yusuf
modified on Saturday, February 02, 2008 7:09:11 AM
|
|
|
|
|
Yes, but why would you want to??
What you're asking is a VERY large project. Explaining it in a forum post is really not possible. It would be more like an entire book.
So what little part are you having a problem with?
|
|
|
|
|
How to create Windows Scheduler to data collection program as well as using a Timer control.
|
|
|
|
|
Did you even look into the suggestion Steven gave you or did you just reformat his answer . You really have to do some of the work yourself.
Windows sheduler is part of the operating system - look in the help file and follow the examples!
A timer control is part of VB.net and can be used to create a scheduling application. Check out the help file, search on this site, try google for vb.net timer control.
Never underestimate the power of human stupidity
RAH
|
|
|
|