473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Why are my method Returns being truncated?

I know that I get pretty dumb late in the day, so I hope someone can just
point out the source my stupidity.

Below is partial code from a class. I'm accessing the 2 properties and
getting truncated results for both. For discussion's sake I'll just describe
1 of them - 'DefaultFileExtension'. This property's ReadOnly method calls the
'GetDefaultFileExtensions' function which should return the value of a
constant, which in this case is "*.pdf". Look at the 2 'MsgBox' items in the
code. I put them there for debugging. The message box inside of the
'GetDefaultFileExtensions' function displays "*.pdf". The message box in the
'DefaultFileExtension. property get displays "*" as the returned value from
'GetDefaultFileExtensions'.

I've tried replacing the sReturn variable with the literal "*.pdf" and still
get the same result. Also recompiled, and even rebooted.

I'm stumped and open to suggestions.

Thanks, Tom
'******************************************
Friend Class clsFileDefinitionStructure
Friend Enum fdFileType
PDF_ft
Image_ft
End Enum

Private Const mc_DefaultFiletypeDescription_PDF As String = "PDF files"
Private Const mc_DefaultFiletypeDescription_Image As String = "Image
files"
Private Const mc_DefaultFileExtension_PDF As String = "*.pdf"
Private Const mc_DefaultFileExtension_Image As String =
"*.gif;*.bmp;*.jpg;*.jpeg;*.tif;*.png;*.pcd;*. pcx"

Private m_FileType As fdFileType = fdFileType.PDF_ft

Friend ReadOnly Property DefaultFileExtension() As String
Get
MsgBox(GetDefaultFileExtensions(m_FileType))
Return GetDefaultFileExtensions(m_FileType)
End Get
End Property

Friend ReadOnly Property DefaultFileTypeDescription() As String
Get
Return GetDefaultFileTypeDescription(m_FileType)
End Get
End Property

Private Function GetDefaultFileExtensions() As String
Dim sReturn As String
Select Case m_FileType
Case fdFileType.Image_ft
sReturn = mc_DefaultFileExtension_Image
Case fdFileType.PDF_ft
sReturn = mc_DefaultFileExtension_PDF
Case Else
sReturn = "*.*"
End Select
MsgBox(sReturn)
Return sReturn
End Function

Private Function GetDefaultFileTypeDescription() As String
Dim sReturn As String
Select Case m_FileType
Case fdFileType.Image_ft
sReturn = mc_DefaultFiletypeDescription_Image
Case fdFileType.PDF_ft
sReturn = mc_DefaultFiletypeDescription_PDF
Case Else
sReturn = "All Files"
End Select
Return sReturn
End Function
End Class
--
Tom Garth
Aug 14 '07 #1
2 1324
"Tom Garth" <To******@discussions.microsoft.comschrieb
I know that I get pretty dumb late in the day, so I hope someone can
just point out the source my stupidity.

Below is partial code from a class. I'm accessing the 2 properties
and getting truncated results for both. For discussion's sake I'll
just describe 1 of them - 'DefaultFileExtension'. This property's
ReadOnly method calls the 'GetDefaultFileExtensions' function which
should return the value of a constant, which in this case is
"*.pdf". Look at the 2 'MsgBox' items in the code. I put them there
for debugging. The message box inside of the
'GetDefaultFileExtensions' function displays "*.pdf". The message
box in the 'DefaultFileExtension. property get displays "*" as the
returned value from 'GetDefaultFileExtensions'.

I've tried replacing the sReturn variable with the literal "*.pdf"
and still get the same result. Also recompiled, and even rebooted.

I'm stumped and open to suggestions.

Thanks, Tom
'******************************************
Friend Class clsFileDefinitionStructure
Friend Enum fdFileType
PDF_ft
Image_ft
End Enum

Private Const mc_DefaultFiletypeDescription_PDF As String = "PDF
files" Private Const mc_DefaultFiletypeDescription_Image As
String = "Image files"
Private Const mc_DefaultFileExtension_PDF As String = "*.pdf"
Private Const mc_DefaultFileExtension_Image As String =
"*.gif;*.bmp;*.jpg;*.jpeg;*.tif;*.png;*.pcd;*. pcx"

Private m_FileType As fdFileType = fdFileType.PDF_ft

Friend ReadOnly Property DefaultFileExtension() As String
Get
MsgBox(GetDefaultFileExtensions(m_FileType))
Return GetDefaultFileExtensions(m_FileType)
End Get
End Property

Friend ReadOnly Property DefaultFileTypeDescription() As String
Get
Return GetDefaultFileTypeDescription(m_FileType)
End Get
End Property

Private Function GetDefaultFileExtensions() As String
Dim sReturn As String
Select Case m_FileType
Case fdFileType.Image_ft
sReturn = mc_DefaultFileExtension_Image
Case fdFileType.PDF_ft
sReturn = mc_DefaultFileExtension_PDF
Case Else
sReturn = "*.*"
End Select
MsgBox(sReturn)
Return sReturn
End Function

Private Function GetDefaultFileTypeDescription() As String
Dim sReturn As String
Select Case m_FileType
Case fdFileType.Image_ft
sReturn = mc_DefaultFiletypeDescription_Image
Case fdFileType.PDF_ft
sReturn = mc_DefaultFiletypeDescription_PDF
Case Else
sReturn = "All Files"
End Select
Return sReturn
End Function
End Class

This is awesome... The thing is that

GetDefaultFileExtensions(m_FileType)

is short for

GetDefaultFileExtensions.Chars(m_FileType)

because Chars is the default property of a String, and because
GetDefaultFileExtensions does /not/ have arguments. As m_FileType is 0, this
is actually

GetDefaultFileExtensions.Chars(0)

So, you get the first char of the string, which is "*" only.
Armin

Aug 14 '07 #2
Awesome answer as well! That's really cool. Thanks very much for "decoding"
that one.
--
Tom Garth
"Armin Zingler" wrote:
"Tom Garth" <To******@discussions.microsoft.comschrieb
I know that I get pretty dumb late in the day, so I hope someone can
just point out the source my stupidity.

Below is partial code from a class. I'm accessing the 2 properties
and getting truncated results for both. For discussion's sake I'll
just describe 1 of them - 'DefaultFileExtension'. This property's
ReadOnly method calls the 'GetDefaultFileExtensions' function which
should return the value of a constant, which in this case is
"*.pdf". Look at the 2 'MsgBox' items in the code. I put them there
for debugging. The message box inside of the
'GetDefaultFileExtensions' function displays "*.pdf". The message
box in the 'DefaultFileExtension. property get displays "*" as the
returned value from 'GetDefaultFileExtensions'.

I've tried replacing the sReturn variable with the literal "*.pdf"
and still get the same result. Also recompiled, and even rebooted.

I'm stumped and open to suggestions.

Thanks, Tom
'******************************************
Friend Class clsFileDefinitionStructure
Friend Enum fdFileType
PDF_ft
Image_ft
End Enum

Private Const mc_DefaultFiletypeDescription_PDF As String = "PDF
files" Private Const mc_DefaultFiletypeDescription_Image As
String = "Image files"
Private Const mc_DefaultFileExtension_PDF As String = "*.pdf"
Private Const mc_DefaultFileExtension_Image As String =
"*.gif;*.bmp;*.jpg;*.jpeg;*.tif;*.png;*.pcd;*. pcx"

Private m_FileType As fdFileType = fdFileType.PDF_ft

Friend ReadOnly Property DefaultFileExtension() As String
Get
MsgBox(GetDefaultFileExtensions(m_FileType))
Return GetDefaultFileExtensions(m_FileType)
End Get
End Property

Friend ReadOnly Property DefaultFileTypeDescription() As String
Get
Return GetDefaultFileTypeDescription(m_FileType)
End Get
End Property

Private Function GetDefaultFileExtensions() As String
Dim sReturn As String
Select Case m_FileType
Case fdFileType.Image_ft
sReturn = mc_DefaultFileExtension_Image
Case fdFileType.PDF_ft
sReturn = mc_DefaultFileExtension_PDF
Case Else
sReturn = "*.*"
End Select
MsgBox(sReturn)
Return sReturn
End Function

Private Function GetDefaultFileTypeDescription() As String
Dim sReturn As String
Select Case m_FileType
Case fdFileType.Image_ft
sReturn = mc_DefaultFiletypeDescription_Image
Case fdFileType.PDF_ft
sReturn = mc_DefaultFiletypeDescription_PDF
Case Else
sReturn = "All Files"
End Select
Return sReturn
End Function
End Class


This is awesome... The thing is that

GetDefaultFileExtensions(m_FileType)

is short for

GetDefaultFileExtensions.Chars(m_FileType)

because Chars is the default property of a String, and because
GetDefaultFileExtensions does /not/ have arguments. As m_FileType is 0, this
is actually

GetDefaultFileExtensions.Chars(0)

So, you get the first char of the string, which is "*" only.
Armin

Aug 14 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jay Chan | last post by:
The transaction log in a database in our SQLSERVER-2000 server has grown to 16GB. I cannot shrink the transaction log manually because it says that the entire 16GB log size is not free. This is...
2
by: mokles | last post by:
Hello All, The setting is SQL server 7, on Windows NT. If the distributor can not access the log on the publisher database ( but subscribers are not deleted yet), will the full backup of the...
2
by: | last post by:
Hi everyone, I'm using VS.NET, Framework 1.1, Windows 2000 Server, IIS 5, all the latest patches are installed. Im having this wierd random problem, that I cannot reproduce but it happens...
5
by: z. f. | last post by:
hi, i have a vb.net web application and i make a request using internet explorer to an aspx page. the aspx page size if over 170KB, and the page in internet explorer looks truncated and in the...
19
by: Flavio | last post by:
hi, I have an object defined with a number of hardcoded methods. Class soandso: def __init__(self): self.this = 0 self.that = 1 def meth1(self): ...
0
by: David A. Schramm | last post by:
I am using OLE DB in .NET 2 to insert a row into an Access database. The source is a RTF control and the column is a Memo field. The data is being truncated along the way. The control's rtf...
25
by: John Salerno | last post by:
Forgive my excitement, especially if you are already aware of this, but this seems like the kind of feature that is easily overlooked (yet could be very useful): Both 8-bit and Unicode strings...
7
Coldfire
by: Coldfire | last post by:
i am having error ....details are ASP.Net application...in which I have a textbox <asp:TextBox ID="Other" TextMode=SingleLine CssClass="serviceBox" Width="250" Height="45" Runat="server"...
0
by: data monkey | last post by:
My company's web application uses mySQL databases. I have linked these tables (Read only) into Access 2007 so I can create queries and reports. Now I need to extract some of the content from these...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.