|
-
Sep 4th, 2005, 07:06 PM
#1
Thread Starter
Admodistrator
Reading ini, but not by exact line?
VB Code:
Public Function GetSett(Section As String, Entry As String, strbuff As String, jPLace As String) As String
strbuff = String(256, 0)
c = GetPrivateProfileString(Section, Entry, _
"", strbuff, Len(strbuff), jPLace)
GetSett = Left$(strbuff, c)
End Function
Ive written this nice sub just to read an ini file, but im wondering..is it possible to read a line by an not-exact name? i could read it by regular I/O but this is much faster
-
Sep 4th, 2005, 07:21 PM
#2
Re: Reading ini, but not by exact line?
Depends. If you know the section your line is in then you can only have to read a few lines to find the partial matches. If you dont know the section then you can use File I/O to read it like a regular textfile with LOF. Then split into an array and loop line by line matching only the partials.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 4th, 2005, 07:24 PM
#3
Thread Starter
Admodistrator
Re: Reading ini, but not by exact line?
Well i have about 300 line file, and it has the word im searching for and a number so it will look like this in some parts
111 cat
112 cat spanish
113 cat french
etc etc..but say i need to find the line with just cat or just cat spanish? i dont really want to use regular i/o because it will waste time. Anyways, thanks
-
Sep 4th, 2005, 07:26 PM
#4
Re: Reading ini, but not by exact line?
Yes, much more faster to use the API since you only want to make the call a few times for these type of situations. 
Btw, why not just regroup your ini so its easier to read? What is the numbers for?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|