473,508 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error in me.show()

ed
Hi I can't seem to make the Me.Show() work

My code is

dim dlgresult as dialogresul

dlgresult=me.show(

The message is : "expression does not produce a value

But if I sue this: dlgresult=Me.ShowDialog(), it works. It's just that I need my form to me modeless

What am I missing here

Thanks :)
Nov 20 '05 #1
20 2411
Hello,

Me.Show() doesn't return a value this is because its modeless and execution
continues without waiting.

Just try Me.Show() on its own.

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
-
"ed" <an*******@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
Hi I can't seem to make the Me.Show() work.

My code is:

dim dlgresult as dialogresult

dlgresult=me.show()

The message is : "expression does not produce a value"

But if I sue this: dlgresult=Me.ShowDialog(), it works. It's just that I
need my form to me modeless.

What am I missing here?

Thanks :)

Nov 20 '05 #2
Hi Ed,

But if I sue this: dlgresult=Me.ShowDialog(), it works.


Does this works, what did you more on your form to create this.

You shows a form itself again as a dialog withouth instancing a new one?

Tell something more what you want to archieve.

Cor
Nov 20 '05 #3
Ed
Oh I see. The problem now is that i need to return a value....to make it clearer, here's the rest of the code: (sorry for not showing this earlier

dim dlgresult as dialogresul

dlgresult=me.show(

select case dlgresul
Case DialogResult.Cance
-----right code her

Case DialogResult.Chang
-----right code her

Case DialogResult.Ignor
-----right code her

end selec

As you said, Me.Show doesnt return a value, how can i make my code above work? Is there a workaround? Thanks :

Hello

Me.Show() doesn't return a value this is because its modeless and execution
continues without waiting

Just try Me.Show() on its own

Regard
Simon Jefferie
Tools Programmer, Headfirst Production
mailto:si****@headfirst.co.u

"ed" <an*******@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com..
Hi I can't seem to make the Me.Show() work
My code is
dim dlgresult as dialogresul
dlgresult=me.show(
The message is : "expression does not produce a value
But if I sue this: dlgresult=Me.ShowDialog(), it works. It's just that I

need my form to me modeless
What am I missing here
Thanks :)

Nov 20 '05 #4
Ed
Hi Cor

What I'm doing here is a spell check routine. The spell check form will appear if it sees a misspelled word. If it finds one, then it will run this code

-----start code----

startPos = InStr(1, ctrl.Text, strWord
wordLength = Len(strWord
ctrl.Select(startPos - 1, wordLength
ctrl.Focus(

dim dlgresult as dialogresul
dlgresult=me.show(

select case dlgresul
Case DialogResult.Cance
-----right code her

Case DialogResult.Chang
-----right code her

Case DialogResult.Ignor
-----right code her

end selec
----end code---

Basically, the main reason why i want the spell checker form to be modeless is because after finding a misspelled word, it will highlight that word. If the spell checker form is modal then the focus will always be on the spell checker form, thus the highlight won't be shown in the main form

The problem now is that dlgresult=me.show won't work, it only works if it's dlgresult=me.showdialog(). How can i make it work? Thanks :

edga

Hi Ed
But if I sue this: dlgresult=Me.ShowDialog(), it works

Does this works, what did you more on your form to create this
You shows a form itself again as a dialog withouth instancing a new one
Tell something more what you want to archieve

Co

Nov 20 '05 #5
"Ed" <an*******@discussions.microsoft.com> schrieb
Oh I see. The problem now is that i need to return a value....to make
it clearer, here's the rest of the code: (sorry for not showing this
earlier)


/When/ should it return a value?
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6
Hi Ed,

Normaly it goes something like this
dim dlgresult as dialogresult dim myDialog as new FormDialog dlgresult=myDialog.showDialog


Cor
Nov 20 '05 #7
On your SpellCheck form, when the Ok Button (or any button for that matter)
is clicked just do

Me.DialogResult = --- whatever ---

then hide the form...

thats the exact same thing show dialog does...
"Ed" <an*******@discussions.microsoft.com> wrote in message
news:8A**********************************@microsof t.com...
Oh I see. The problem now is that i need to return a value....to make it clearer, here's the rest of the code: (sorry for not showing this earlier)
dim dlgresult as dialogresult

dlgresult=me.show()

select case dlgresult
Case DialogResult.Cancel
-----right code here

Case DialogResult.Change
-----right code here

Case DialogResult.Ignore
-----right code here

end select

As you said, Me.Show doesnt return a value, how can i make my code above work? Is there a workaround? Thanks :)

Hello,

Me.Show() doesn't return a value this is because its modeless and execution continues without waiting.

Just try Me.Show() on its own.

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
-
"ed" <an*******@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.com...
Hi I can't seem to make the Me.Show() work.
My code is:
dim dlgresult as dialogresult
dlgresult=me.show()
The message is : "expression does not produce a value"
But if I sue this: dlgresult=Me.ShowDialog(), it works. It's just that
I need my form to me modeless.
What am I missing here?
Thanks :)


Nov 20 '05 #8
Ed
I changed my code to

Me.Show(

select case me.dialogresul
Case DialogResult.Cance
-----right code her

Case DialogResult.Chang
-----right code her

Case DialogResult.Ignor
-----right code her

end selec

there are no more error messages. The problem now is that the code will continue executing after Me.Show without waiting for an event on the spell check form. How can I make it stop after the Me.show? Is it possible? What i want to happen is somehow mimic the ME.ShowDialog(), but unlike it, i can switch forms (modeless).

Thanks

Ed
Nov 20 '05 #9
Ed,
It sounds like you are confusing returning a single value once and returning
a value multiple times.

The point behind a modeless form is to allow returning a value multiple
times. The easiest way to return a value multiple times is to have your form
raise an event.

I would recommend having the dialog raise an event when the parent form
needs Cancel, Change, or Ignore.

You then either need to use a WithEvents variable or AddHandler &
RemoveHandler to handle the events the dialog raises.

Hope this helps
Jay

"Ed" <an*******@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
I changed my code to:

Me.Show()

select case me.dialogresult
Case DialogResult.Cancel
-----right code here

Case DialogResult.Change
-----right code here

Case DialogResult.Ignore
-----right code here

end select

there are no more error messages. The problem now is that the code will continue executing after Me.Show without waiting for an event on the spell
check form. How can I make it stop after the Me.show? Is it possible? What i
want to happen is somehow mimic the ME.ShowDialog(), but unlike it, i can
switch forms (modeless).
Thanks,

Ed

Nov 20 '05 #10
"Ed" <an*******@discussions.microsoft.com> schrieb
I changed my code to:

Me.Show()

select case me.dialogresult
Case DialogResult.Cancel
-----right code here

Case DialogResult.Change
-----right code here

Case DialogResult.Ignore
-----right code here

end select

there are no more error messages. The problem now is that the code
will continue executing after Me.Show without waiting for an event on
the spell check form. How can I make it stop after the Me.show? Is it
possible? What i want to happen is somehow mimic the ME.ShowDialog(),
but unlike it, i can switch forms (modeless).


That's why I asked /when/ it should return a value.
--
Armin

Nov 20 '05 #11
ed
When the spell check form appears (that is when the Me.Show executes), It should wait for a response from the spell check form as to what button is to be clicked. For example, if the Cancel button is click it should run this part of the code

select case Me.DialogResul

case DialogResult.Cance
-------code to be execute

end selec

I'm sorry for the confusion but what i really meant was that it will be waiting for an event (not returning a value)

ed
Nov 20 '05 #12
Hi Ed,

Did you look at what I did write?

Why does that not work?

Cor
Nov 20 '05 #13
"ed" <an*******@discussions.microsoft.com> schrieb
When the spell check form appears (that is when the Me.Show
executes), It should wait for a response


If you want to wait, why not use Showdialog?
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #14
Here is an alternative.

How about you add an event handler to the LostFocus event of the form. Now,
understand this is going to be some pretty extensive work, but I think it
will solve your problem.

Then on lost focus you would set the focus back on the form. Here is where
it gets tricky, because say a user wants to click on another application,
however, with the spell check open and the lost focus event (or deactivated
whatever) we can't do this "as-is"

So then when you lose focus, I think you can use the API to get the next
window that is being selected, get its handle, compare that handle to the
handles within your application (so your going to have to reference the
calling form, easy enough), if its in yyour application, then focus back on
the spell check window, otherwise, let it go.

Then on your activate you can perform the same action. Given, there are
probably 100 situations that could exist you need to consider, but maybe
this will give you a starting point.

HTH,
CJ
"Ed" <an*******@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com...
I changed my code to:

Me.Show()

select case me.dialogresult
Case DialogResult.Cancel
-----right code here

Case DialogResult.Change
-----right code here

Case DialogResult.Ignore
-----right code here

end select

there are no more error messages. The problem now is that the code will continue executing after Me.Show without waiting for an event on the spell
check form. How can I make it stop after the Me.show? Is it possible? What i
want to happen is somehow mimic the ME.ShowDialog(), but unlike it, i can
switch forms (modeless).
Thanks,

Ed

Nov 20 '05 #15
ed
Armin
First, here's my objective....If there there is a misspelled word in a textbox on the main form, the spell check form will appear and at the same time, the misspelled word on the main form should be highlighted (I used textbox.select() for this one). By the way, the spell check form is somewhat similar to the spell checker of word

Here comes the problem.... since the spell check form is modal, the highlight for the misspelled word cannot be seen since the focus of the application is on the spell check form. I'm pretty much sure that my code for the highlighting of the misspelled word is working because if i close the spell check form (meaning it loses focus on it and brings the focus back on the main form), i can see that the misspelled word is highlighted

Now just an FYI, this is a complex application handed over to me for maintenance purposes so the whole app is really not my code. What I'm trying to do now is to do as little change to the code as possible (if it can be done, which i hope :p

Cor

Now this is the main reason why I can't just apply the code that you wrote. I know it should be like that too (and as simple as that :)) it's just that the original designer of the code didn't make it that way, he did it a little bit more complex :

CJ
I appreciate the alternative but whoah....i guess i agree with you when you said "extensive" :) Like I said above, I like to do as little change as possible to the code, nevertheless, I will try your suggestion if there are no more easy alternatives :

Jay B. Harlow

As i said above, the original code did not come from me. I was about to try your suggestion but when i saw the code, there is already an eventhandler for each of the button_click events. Aside from the select case Me.dialogresult..... that will process what was clicked on the spell check form, it also has an event handler. Now i have yet to understand how that works but i will work on it :

Thanks again to everyone :) I hope i have cleared some of your questions.....so with those in mind....any more suggestions? :

armi
If you want to wait, why not use Showdialog


Nov 20 '05 #16
ed
By the way, the part of the code which i am writing myself is onlt the highlighting if the misspelled word. This is the code

---start cod
'ctrl is the textbox contro

startPos = InStr(1, ctrl.Text, strWord
wordLength = Len(strWord
ctrl.Select(startPos - 1, wordLength
ctrl.Focus(
---end cod
Nov 20 '05 #17
Hi Ed,

I think you should not be happy with that, I could not understand it,
however now I start to think that someone could have written something as
this.
\\\
Shadows Sub Show()
Dim frm As New Form2
Dim result As DialogResult
result = frm.ShowDialog()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.Hide()
Me.Show()
Me.Button1.Parent.Show()
End Sub
///

If this is true you are working on a in my idea, as I call them, by the
maker obfuscated program.

Cor

Nov 20 '05 #18
"ed" <an*******@discussions.microsoft.com> schrieb

Well.... then you don't want to wait. You want to be notified of something.
I still don't know when, but notifications can be sent by raising an event.
I believe this has already been suggested.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #19
Ed,
It sounds like you seriously need to reconsider what you are attempting!
Consider rewriting the spell check form (from scratch if necessarily), so it
functions in the manner that you require, of course I would question any
spell check form that required ShowDialog anyway.

As has been pointed out only ShowDialog returns the DialogResult. If you
need to use Show, then you need another method to return the DialogResult,
most if not all of these other methods will require your spell form to raise
an event or some sort, otherwise how would the first form know that the
DialogResult was available from the spell check form?

Remember when you design a form, developers rarely design a form to support
both Show & ShowDialog, they design it to use one or the other, at least I
cannot think of a reason why I would design a form to support both. If the
Spell Dialog was designed to return a DialogResult, it sounds like it was
only designed to use ShowDialog, hence your problems.

In other words do it "correctly", any thing else, as Cor puts it, is an
"obfuscated program", a very hard to read & understand program.

Hope this helps
Jay

"ed" <an*******@discussions.microsoft.com> wrote in message
news:68**********************************@microsof t.com...
Armin,
First, here's my objective....If there there is a misspelled word in a textbox on the main form, the spell check form will appear and at the same
time, the misspelled word on the main form should be highlighted (I used
textbox.select() for this one). By the way, the spell check form is somewhat
similar to the spell checker of word.
Here comes the problem.... since the spell check form is modal, the highlight for the misspelled word cannot be seen since the focus of the
application is on the spell check form. I'm pretty much sure that my code
for the highlighting of the misspelled word is working because if i close
the spell check form (meaning it loses focus on it and brings the focus back
on the main form), i can see that the misspelled word is highlighted.
Now just an FYI, this is a complex application handed over to me for maintenance purposes so the whole app is really not my code. What I'm trying
to do now is to do as little change to the code as possible (if it can be
done, which i hope :p)
Cor,

Now this is the main reason why I can't just apply the code that you wrote. I know it should be like that too (and as simple as that :)) it's
just that the original designer of the code didn't make it that way, he did
it a little bit more complex :p
CJ,
I appreciate the alternative but whoah....i guess i agree with you when you said "extensive" :) Like I said above, I like to do as little change as
possible to the code, nevertheless, I will try your suggestion if there are
no more easy alternatives :)
Jay B. Harlow,

As i said above, the original code did not come from me. I was about to try your suggestion but when i saw the code, there is already an
eventhandler for each of the button_click events. Aside from the select case
Me.dialogresult..... that will process what was clicked on the spell check
form, it also has an event handler. Now i have yet to understand how that
works but i will work on it :p
Thanks again to everyone :) I hope i have cleared some of your questions.....so with those in mind....any more suggestions? :)

armin
If you want to wait, why not use Showdialog?

Nov 20 '05 #20
ed
Ok...i'll just see what i can do with this one...neway, thanks for all your help :)
Nov 20 '05 #21

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

Similar topics

1
5011
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
7
3038
by: Paul | last post by:
I thought this is more of an IE issue but i've had no joy on that group perhaps somebody here will have a clue. If i click a link to a web page embedded in Excel (97 OR 2000) i get the standard...
2
9353
by: Dayron | last post by:
Hi, I use ASP code to generate report that I retrieve about 100,000 to 800,000 records from database using ADODB.Recordset. But when i run the code, it show me the following error. Provider...
0
1193
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type...
0
3026
by: Morten Gulbrandsen | last post by:
mysql> USE company; Database changed mysql> mysql> DROP TABLE IF EXISTS EMPLOYEE; -------------- DROP TABLE IF EXISTS EMPLOYEE -------------- Query OK, 0 rows affected (0.00 sec)
13
6572
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
3
2727
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command...
0
4779
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
0
1303
by: calvinkwoo3000 | last post by:
My window application run property before i set a password at mdb file. Below is my connection string that before and after set password conn = new...
11
5556
by: xenoix | last post by:
hey there, im reasonably new to C# and im currently writing a backup application which im using as a learning resource. My PC :- Visual Studio 2005 .NET Framework 2 Component Factory Krypton...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5045
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.