I'm Learning how to code in Visual Basic (with VB Express 2005) and i'm trying to code A ZDoom Frontend but i'm stumbling upon problems with getting the filename for the PWAD's that people might want to use in the command line. here's the little bit of code that's the problem:
Code:
********Dim WAD As System.Type "Class 'System.Type' cannot be indexed because it has no default property." now i'm not sure why this is happening but please keep in mind that i've only just started learning how to code and i'm managing to get my head around the logic behind most of what i have seen so far but i can't figure some things out. |
<div class='quotetop'>QUOTE(JJXB @ Apr 20 2007, 04:39 AM) [snapback]287605[/snapback]</div>
Quote:
Dim WAD As System.Type as stated my VB is a 'bit' lousy at times but will a string variable type not do for that value? , i'm not really sure what you are trying to define this as so appologies if this is totally incorrect!!!! |
setting it as a string gives me a different error completely, i'm not in VB at the sec so i can't tell you it at the sec
|
Use the following code (I'm a C# guy, so I'm not sure if the VB syntax is correct... I more or less HATE VB syntax :P):
Code:
Dim openFileDialog1 as OpenFileDialog Your code tried to do quite a lot of other things. By leaving out the .Text, you're trying to set the TextBox object directly instead of its Text property. And, what you think an object of type Type is exactly? |
i've looked at the code and tried adapting it so it now looks like this (the full block of code now, not just the problem bit)
Code:
********Dim OpenFileDialog1 As New OpenFileDialog() Quote:
|
Mm... I copied this more or less from my C# file, which compiled and ran without errors... Did you add the System.IO namespace to you Imports?
The thing is, that you never have to declare Path, since its a Static class and can't be instantiated... :unsure: |
I have used this and it seems to work but it gives the full filepath and the only way I could chop it up was a very awkward use of mid!
Code:
|
That's what the Path-class takes care of. You know Path.GetFileName of Path.GetFileNameWithoutExtension etc. Check out the full range @ http://msdn2.microsoft.com/en-us/library/s...ers(vs.71).aspx
(this is .NET 1.1 version, since I don't know against which framework you're programming). |
<div class='quotetop'>QUOTE(Reup @ Apr 24 2007, 07:30 AM) [snapback]288251[/snapback]</div>
Quote:
doh!, i have never really used VB to this level but finally managed a working code, although it is not quite as yours seems to be it seems to work :) - (Visual Basic Express 2005 ) Code:
|
just got round to trying it and it works a treat :) plus i adapted the code to
Code:
Dim WAD As System.IO.FileInfo |
The current time is 06:34 PM (GMT) |
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.