Why does Message Box does not display complete Message 
Author Message
 Why does Message Box does not display complete Message

hi,

Appreciate if some one could tell me what wrong with this code:

Title = "Message Box"
Msg$="FILE:" & FileNameRST(i) & "not Found"
response = MsgBox(Msg$,MB_OKCANCEL,Title)
if response = IDOK then
 do something...
else
exit sub

Q:When this message box pops up it does not display "not Found" string.
  FileNameRST(i) a array variable which stores a file name with path of
  66 characted length.



Sun, 07 Dec 1997 03:00:00 GMT  
 Why does Message Box does not display complete Message

Quote:
> Appreciate if some one could tell me what wrong with this code:

> Title = "Message Box"
> Msg$="FILE:" & FileNameRST(i) & "not Found"
> response = MsgBox(Msg$,MB_OKCANCEL,Title)
> if response = IDOK then
>  do something...
> else
> exit sub

> Q:When this message box pops up it does not display "not Found" string.
>   FileNameRST(i) a array variable which stores a file name with path of
>   66 characted length.

At a guess, I'd say that the strings in FileNameRST() are null-terminated. Use the following to remove the null;

If InStr(FileNameRST(i), Chr$(0)) > 0 Then
    Msg$ = "FILE: " & Mid$(FileNameRST(i), 1, InStr(FileNameRST(i)) - 1) & " not found"
Else
    Msg$ = "FILE: " & FileNameRST(i) & " not found"
End If

 --

   Cheers,

       Stu.



Mon, 08 Dec 1997 03:00:00 GMT  
 Why does Message Box does not display complete Message

Quote:

> hi,
> Appreciate if some one could tell me what wrong with this code:
> Title = "Message Box"
> Msg$="FILE:" & FileNameRST(i) & "not Found"
> response = MsgBox(Msg$,MB_OKCANCEL,Title)
> if response = IDOK then
>  do something...
> else
> exit sub
> Q:When this message box pops up it does not display "not Found" string.
>   FileNameRST(i) a array variable which stores a file name with path of
>   66 characted length.

Does FileNameRST(i) contain any Chr$(0)'s? VB's MsgBox uses the
MessageBox API call, which expects C-style Chr$(0)-terminated
strings. If a Chr$(0) appears anywhere in the strings you pass as
the title or the message text, MessageBox will think that's the
end of the string.

--

WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Mon, 08 Dec 1997 03:00:00 GMT  
 Why does Message Box does not display complete Message

: Title = "Message Box"
: Msg$="FILE:" & FileNameRST(i) & "not Found"
: response = MsgBox(Msg$,MB_OKCANCEL,Title)
: if response = IDOK then
:  do something...
: else
: exit sub

: Q:When this message box pops up it does not display "not Found" string.
:   FileNameRST(i) a array variable which stores a file name with path of
:   66 characted length.

 I'm only guessing here... when you say the array contains strings of 66
characters in length, what happens if the actual path\file is shorter?

 You might want to ensure that you don't have any trailing blanks (i.e.
use Trim$() on the FileNameRST(I) element when constructing the
message, and also make sure that there is no CHR$(0) anywhere in the
FileNameRST(I) string: these are often interpreted as the end of the
string by external VBX's and services; maybe MsgBox is also bothered
by it...



Mon, 08 Dec 1997 03:00:00 GMT  
 Why does Message Box does not display complete Message

Quote:

> Path:
> hi,

> Appreciate if some one could tell me what wrong with this code:

> Title = "Message Box"
> Msg$="FILE:" & FileNameRST(i) & "not Found"
> response = MsgBox(Msg$,MB_OKCANCEL,Title)
> if response = IDOK then
>  do something...
> else
> exit sub

> Q:When this message box pops up it does not display "not Found" string.
>   FileNameRST(i) a array variable which stores a file name with path of
>   66 characted length.

There is nothing wrong with the code but If I were you I would check that
FileNameRST(i) doesn't have a NULL in it (CHR$(0)).

Steve.



Tue, 09 Dec 1997 03:00:00 GMT  
 Why does Message Box does not display complete Message
If FileNameRST(i) is a fixed-length string, try Trim$ to lop off
padding.  Check the string for Null characters as well, as MsgBox sees
Null as a terminate -string instruction and won't concatenate anything
beyond it (the Null character, that is).  Additionally, although it
probably doesn't apply to this case, Msgbox has a character limit
(something like 1200 bytes, if I remember correctly.  If you've invoked
a 3D Msgbox with CTRL3Dxx.DLL, that limit is substantially lower, and
your string could be truncated.

Quote:
> Appreciate if some one could tell me what wrong with this code:
> Title = "Message Box"
> Msg$="FILE:" & FileNameRST(i) & "not Found"
> response = MsgBox(Msg$,MB_OKCANCEL,Title)
> if response = IDOK then
>  do something...
> else
> exit sub
> Q:When this message box pops up it does not display "not Found"
> string.   FileNameRST(i) a array variable which stores a file name
>   with path of 66 characted length.

------------------------------------------------------

------------------------------------------------------


Thu, 11 Dec 1997 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Label change event not occurring when Message Box displayed

2. Why My message did mot display?

3. ADO thinks DBMS is done, but DBMS ain't done

4. How can I display a message (box) while something executes, and goes away when its done.

5. Using Message Box as a Stand-by Message

6. Pocket PC Message and Importand message boxes

7. Trapping Warning Messages, NOT Error Messages

8. Messaging Services and their use (not email messaging)

9. Message Loops - Why not?

10. Message Loops - Why not?

11. Message Box Display

12. Message box display

 

 
Powered by phpBB® Forum Software