Lanc1988 Posted July 15, 2008 Posted July 15, 2008 Hello, I am not a really advanced vb.net coder but I would like to make a simple database that can be searchable. Basically I have a list of about 1500 NPC names and for each one of those I have various information about them such as Location, Level, etc. Currently the only way I can think to do something like this would be to make 1500 .dat files and put them in a directory and then have a button that when pressed with load all the .dat file names into a listview (set to detail view) and then when the user double clicks an item it will display the information (Location, Level, etc.) (I haven't put all of the 1500 NPC and information into the .dat files yet) This idea would make it easy to add more when needed but I don't think it would be searchable and even if it is, I would think there is a much better way to go about doing what I want to do.. so any help would be great. Thanks. Quote
Administrators PlausiblyDamp Posted July 16, 2008 Administrators Posted July 16, 2008 Have you considered using an actual database for this? SQL Express is free and for a limited number of users would probably be ideal in this situation. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Nate Bross Posted July 16, 2008 Posted July 16, 2008 Recently, I've been a big fan of XML Serialization: This will work for a reasonable number of objects, depending on the number of properties you want to Serialize. However, this will not scale up as well as PDs sugestion of SQL Express -- the advantage is that you can manually open the XML file with notepad and make changes without any programming. <Serializable>_ Public Class myNPC Sub New() End Sub ' not positive on VB Syntax Public Property Location as Point Get Return new Location(x,y) End Get Set x = value.X y = value.Y End Set .... etc etc End Property End Class ...form code... dim myNPCs as List<myNPC> = new List<myNPC>(1500) Sub Button_Click(..) Dim x as System.Xml.Serialization.XmlSerializer = new System.Xml.Serialization.XmlSerializer(GetType(List<myNPC>)) Dim fs as System.IO.FileStream = new System.IO.FileStream("myfile.xml", FileMode.Open) x.Serialize(myNPCs, fs) fs.Close() End Sub You could use a BinaryFormatter which is a more efficent method of Serialization but then you loose the abbility to manually edit the output file from Notepad or your choice text editor. HTH Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Lanc1988 Posted July 16, 2008 Author Posted July 16, 2008 i think the actual database would probably work best but i have no experience with doing anything like that.. so if you could give me a little more info about how to go about using the SQL express to do what I need it would be really helpful. and for the serialization thing, i have never heard of that before and it sounds like it might be better to to the actual database if i am going to spend the time to do all this work. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.