470,573 Members | 1,749 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,573 developers. It's quick & easy.

How the devil do I get screen resolutions??!!?

ARGH! I have a c#.net web application. I need to retrieve screen height
and width into a variable. I know this is incredibly stupid but HOW THE
HECK DO I DO IT??!?!?!

A copy to ri*******@gmail.com would be much appreciate also.

Thanks in advance.

Mar 9 '06 #1
10 4321
Hello ManwSloHand,

What kind of resolution, there are several one :)

See

SystemInformation.PrimaryMonitorSize
SystemInformation.WorkingArea
SystemInformation.VirtualScreen
Screen.PrimaryScreen.Bounds
Screen.PrimaryScreen.WorkingArea

M> ARGH! I have a c#.net web application. I need to retrieve screen
M> height and width into a variable. I know this is incredibly stupid
M> but HOW THE HECK DO I DO IT??!?!?!
M>
M> A copy to ri*******@gmail.com would be much appreciate also.
M>
M> Thanks in advance.
M>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 9 '06 #2
There is class named Screen which may help you.
http://msdn.microsoft.com/library/de...mberstopic.asp
Calm down a little bit, man

"ManwSloHand" <ma*********@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
ARGH! I have a c#.net web application. I need to retrieve screen height
and width into a variable. I know this is incredibly stupid but HOW THE
HECK DO I DO IT??!?!?!

A copy to ri*******@gmail.com would be much appreciate also.

Thanks in advance.

Mar 9 '06 #3
>> ARGH! I have a c#.net web application. I need to retrieve screen
height and width into a variable. I know this is incredibly stupid
but HOW THE HECK DO I DO IT??!?!?!


What kind of resolution, there are several one :)

See

SystemInformation.PrimaryMonitorSize
SystemInformation.WorkingArea
SystemInformation.VirtualScreen
Screen.PrimaryScreen.Bounds
Screen.PrimaryScreen.WorkingArea


I doubt any of that is what he wants since that would get the resolution of
the server you are running on and I would expect he wants the cleint
resolution (note he did say web application). This would need to be done in
client side script that populates variables that would then be posted back
to the server for reading. The values to query in javascript would be
window.screen.width and window.screen.height.
--
Tom Porterfield

Mar 9 '06 #4
Maybe we would see he is talking about web application if he wasn't
screaming all around the relevant text...

"Tom Porterfield" <tp******@mvps.org> wrote in message
news:uz**************@TK2MSFTNGP09.phx.gbl...
ARGH! I have a c#.net web application. I need to retrieve screen
height and width into a variable. I know this is incredibly stupid
but HOW THE HECK DO I DO IT??!?!?!


What kind of resolution, there are several one :)

See

SystemInformation.PrimaryMonitorSize
SystemInformation.WorkingArea
SystemInformation.VirtualScreen
Screen.PrimaryScreen.Bounds
Screen.PrimaryScreen.WorkingArea


I doubt any of that is what he wants since that would get the resolution
of the server you are running on and I would expect he wants the cleint
resolution (note he did say web application). This would need to be done
in client side script that populates variables that would then be posted
back to the server for reading. The values to query in javascript would
be window.screen.width and window.screen.height.
--
Tom Porterfield

Mar 9 '06 #5
Hello Tom,

Sure, my fault, missed web content

there is a sample for ASP.net
ARGH! I have a c#.net web application. I need to retrieve screen
height and width into a variable. I know this is incredibly stupid
but HOW THE HECK DO I DO IT??!?!?!

What kind of resolution, there are several one :)

See

SystemInformation.PrimaryMonitorSize
SystemInformation.WorkingArea
SystemInformation.VirtualScreen
Screen.PrimaryScreen.Bounds
Screen.PrimaryScreen.WorkingArea

TP> I doubt any of that is what he wants since that would get the
TP> resolution of the server you are running on and I would expect he
TP> wants the cleint resolution (note he did say web application). This
TP> would need to be done in client side script that populates variables
TP> that would then be posted back to the server for reading. The
TP> values to query in javascript would be window.screen.width and
TP> window.screen.height.
TP>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 9 '06 #6
you can use javascripts screen.width and screen.height and pass the values
to your app

http://www.devcity.net/Articles/64/1...esolution.aspx

or

http://www.quepublishing.com/article...&seqNum=6&rl=1

both provide good examples

--
Regards

John Timney
Microsoft MVP

"ManwSloHand" <ma*********@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
ARGH! I have a c#.net web application. I need to retrieve screen height
and width into a variable. I know this is incredibly stupid but HOW THE
HECK DO I DO IT??!?!?!

A copy to ri*******@gmail.com would be much appreciate also.

Thanks in advance.

Mar 9 '06 #7
JR
I noticed both of the previous replies were for windows forms and you are
asking for web application so try this
http://www.devcity.net/Articles/64/1...esolution.aspx

HTH
JR

"ManwSloHand" <ma*********@yahoo.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
ARGH! I have a c#.net web application. I need to retrieve screen height
and width into a variable. I know this is incredibly stupid but HOW THE
HECK DO I DO IT??!?!?!

A copy to ri*******@gmail.com would be much appreciate also.

Thanks in advance.

Mar 9 '06 #8
> There is class named Screen which may help you.
http://msdn.microsoft.com/library/de...ary/en-us/cpre...
Calm down a little bit, man


Sorry about the yelling guys. This should be simple but I've been
beating my head against a wall for 4 hours now and can't get it to
work. I can't find how to get the Screen class included into my project
(no using). Also haven't been able to get SystemInformation to work in
a web application either.

I've done it using Javascript in my ASP apps. Had to have JV write a
cookie, then read the cookie from within the ASP script. That might
work (I guess) here but just seems like .Net should've dealt with a
well-known problem like this.

Any more suggestions?

Mar 9 '06 #9
> I noticed both of the previous replies were for windows forms and you are
asking for web application so try this


That's what I'm afraid of. I've been pounding a co-worker of mine with
how great .Net tools are and how un-stable Javascript is. Now I've
gotta eat crow and go back and say "hey, let's use javascript!". Ugh.
Is there a way to use javascript in my page behind code (html) to stick
the resolution into a form control (label or textbox)? I'm thinking I
could grab it in code. BTW, what I'm ultimately after is that I want to
store a database record to record the user's screen res, browser type,
and IP for later analysis.

Thanks again.

Mar 9 '06 #10
On 9 Mar 2006 13:57:24 -0800, ManwSloHand wrote:
That's what I'm afraid of. I've been pounding a co-worker of mine with
how great .Net tools are and how un-stable Javascript is. Now I've
gotta eat crow and go back and say "hey, let's use javascript!".


But client side you are still in a browser, so you are limited to what you
can do within a browser window. Now I suppose you could write a custom
browser control in .NET, embed that in your web page and then use the .NET
code to get the information. This would require the .NET framework be
installed on any client visiting your website. Seems like a bad way to go
when you can get the same info with a couple of lines of javascript. The
key is knowing the appropriate tool to use for each given situation.
--
Tom Porterfield
Mar 10 '06 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Les Juby | last post: by
4 posts views Thread by David | last post: by
9 posts views Thread by Steve Wright | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.