|
I have a set of XML files that I parse & put into a dropdown list. I don't want to read this set of files off the network every time the page loads.
I was considering establishing a data set in the GLOBAL.ASAX file in the Session section.
I would just bind that dataset on the page load for this one dropdown where it occurs in the application. NOW, I know I will hear some "purist" objections to using anything that sounds like a global variable, but it seems far more efficient than reading 100+ XML files every time the page loads for every user.
I have tried creating a dataset in the Session_Start, but it isn't clear how I would access it.
Any thoughts?
Also, I am curios if there is an equivalent to a variable declared on a page in VB "Public Shared MyInt As Integer"?
Thanks.
SD
|
|
|
|
|
I found the answer to my tranlation question. There is a nice site that does translations back and forth between VB & C#: http://www.carlosag.net/Tools/CodeTranslator/Default.aspx; however, I would still be interested in any response to my GLOBAL question.
Thanks again,
Sd
|
|
|
|
|
Forget it. This was a bad question. I simply put a public dataset on the page of interest and read the XML into the dataset on if (!PostBack).
Thanks anyway.
Sd
|
|
|
|
|
I've written a small C# assembly which does MX/ANAME lookups on a DNS server to get a list of mail servers/IP addresses for a particular domain, but I'm having some bother in programmatically finding out the IP address of the DNS servers to query. Currently I've hardcoded the IP of two BT DNS servers after looking them up on my DSL router.
Is there a way to find out the IP address(es) of the computer's DNS servers in .NET, and in particular in managed code without resorting to P/Invoke as I try to make my code work with Mono. I've trawled the net and had no luck in finding this out.
I would be most grateful to any genius who could show me the (a) way. Thank you!
Rob Philpott.
|
|
|
|
|
|
Thanks for the response leppie,
I could attempt something of the sort, but on Windows the DLL I'd need to talk to I believe also does MX and ANAME lookups too, making the whole project kind of redundant.
I really need a managed code solution, but I have doubts about whether one exists.
Rob Philpott
|
|
|
|
|
I need to validate text as nunber for 4 TextBoxes. Here is some code I wrote to validate the first TextBox, but this code locks me in the TextBox-- also
although it will handle an error the App won't close and again, I'm "frozen" in this text box. Thanks a lot.....
try
{
cmplxValue1.Real = Convert.ToDouble(textComplex_1Real.Text);
//cmplxValue1.Imaginary = Convert.ToDouble(textComplex_1Imaginary.Text);
}
catch(Exception ex)
{
error = true;
}
finally
{
if(error)
MessageBox.Show("Error");
textBox1.SelectAll();
textBox1.Focus();
e.Cancel = true;
}
}
|
|
|
|
|
|
|
I read RTFM and still don't get it.
e.Cancel = true; means nothing out of context
|
|
|
|
|
|
Wy not read the answers you got when you posted the question only 16 hours earlier, instead of posting it again?
---
b { font-weight: normal; }
|
|
|
|
|
While I am grateful for any response...I read them and they donn't work.
|
|
|
|
|
Well, if they don't work, say so. If you give no response at all to the ones that answer your question, but just post it again, it looks that you are completely ignoring the answers that you already got, giving no regard at all to the people trying to help you. Is that really the way you like to appear?
As you see, you will get the same answers all over again.
And did you really try the way that I suggested?
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: As you see, you will get the same answers all over again.
Tough day?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello everybody here!!!.
i would like to know how can i add new command to the run process of the windows os for example .
press the following
--------------------
start ---> run --->and type ---->cmd or regedit
it will open the MsDos or Registry of the Windows OS respectively but i want to add new command like this of my own is it some string key or entry in the registry that manages this and by the way yahoo messenger do the same when you expose one friend's email from yahoo online member directory, you will see the online icon and you press that icon with this simple html script:
<br />
<a href="ymsgr:sendim?the_Friend_nickname">the online icon</a><br />
and it is it it opens for you private window for chatting with that friend.
I want to add command of my own like this any body has any solutions for this please refer to me with an idea or even an article on this.
As i guess ! it is all related to enter new key value data in the registry in specific part with the extension of your program , but where i don't know any body can help me in this please ..
Thanks From my heart
Mess With The Best And Die Like The Rest
|
|
|
|
|
Simple commands like cmd or regedit can be called because they are programs that can be found with the PATH environment variable. Start->Run also finds programs using the registry key "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" if the program cannot be found using the PATH variable.
Registering new protocol like "ymsgr" is something different, but also quite easy: see http://msdn.microsoft.com/workshop/networking/pluggable/overview/appendix_a.asp[^]
|
|
|
|
|
You posted the exact same question in this exact forum less than 20 hours ago.
Why don't you follow up on the answers you get instead of spamming the forum with the same question again?
---
b { font-weight: normal; }
|
|
|
|
|
I want to know how can i make a wizard like a oledbconnection of Visual studio.net ,
exactly make something like the property Policy File of the component oledbconnection
|
|
|
|
|
I want to draw into a usercontrol when a make click in it at "DESIGN TIME"
|
|
|
|
|
Hello everybody,
How can i open a webpage in C# that has post data already sent to it(or download the HTML code of that page)
example:
A dictionary that uses POST to send the word to the result page. I need a program that can display the coresponding page for the required word.
Thanks in Advance
Afief
|
|
|
|
|
Hi Afief,
I'm not sure if I'm understanding you correctly, and whether you actually want to open a browser window to display the page, or to programmatically receive the content of a page as a result of a POST.
If it's the latter try something similar to below (untested) which POSTS a string to a web-page and captures the response also as a string:
static string Post(string url, string wordToPost)
{
// convert the word to post to a byte array
byte[] postData = new System.Text.ASCIIEncoding().GetBytes(wordToPost);
// create a web request
System.Net.WebRequest request = System.Net.WebRequest.Create(url);
// verb is POST
request.Method = "POST";
// add the post data to this request
System.IO.Stream postStream = request.GetRequestStream();
postStream.Write(postData, 0, postData.Length);
postStream.Close();
// send the request and collect the response
System.Net.WebResponse response = request.GetResponse();
// now read from the response stream the output
System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
string result = reader.ReadToEnd();
// tidy up
reader.Close();
response.Close();
// and return the content
return result;
}
Rgds,
Rob Philpott
|
|
|
|
|
Hi!
I am developing a windows application which crops an image by drawing a rectangle over the image using mouse (RubberBand Effect)
Can somebody tell me how do I keep the Aspect Ratio when drawing Rectangle over the image using mouse.
i.e. when drawing selection in Adobe PhotoShop with Aspect Ratio
Anxiously waiting for reply.
|
|
|
|
|
int startx,starty;
int x,y;
double ratio=1; // change this for photos or screen wallpapers(ie. 1.3333)
if(x<startx)
startx=x;
if(y<starty)
starty=y;
int length;
if((x-startx)="">(y-starty))
length=y-starty;
else
length=x-startx;
drawrect(startx,starty,startx+length,starty+length);
should work. you only have to write drawrect(int x, int y, int endx,int endy) procedure.
|
|
|
|
|
Hello Afief!
Thank you for replying, but, I did not understand your code, you have declared the variable "ratio" but you have not used it any where. I will be pleased if you read my code and modify it for Aspect Ratio functionality.
I will be grateful to you.
Here is my code
<br />
using System;<br />
using System.Drawing;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Windows.Forms;<br />
<br />
namespace WinApp<br />
{<br />
public class frmAspect : System.Windows.Forms.Form<br />
{<br />
private int StartX = 0, StartY = 0, EndX = 0, EndY = 0;<br />
private bool bMouseDown = false;<br />
Rectangle rctRubber = Rectangle.Empty;<br />
<br />
<br />
private System.Windows.Forms.PictureBox pb;<br />
private System.Windows.Forms.Label lblMessage;<br />
private System.ComponentModel.Container components = null;<br />
<br />
public frmAspect()<br />
{<br />
InitializeComponent();<br />
<br />
}<br />
<br />
protected override void Dispose( bool disposing )<br />
{<br />
if( disposing )<br />
{<br />
if(components != null)<br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
<br />
#region Windows Form Designer generated code<br />
private void InitializeComponent()<br />
{<br />
this.pb = new System.Windows.Forms.PictureBox();<br />
this.lblMessage = new System.Windows.Forms.Label();<br />
this.SuspendLayout();<br />
this.pb.Location = new System.Drawing.Point(16, 56);<br />
this.pb.Name = "pb";<br />
this.pb.Size = new System.Drawing.Size(336, 256);<br />
this.pb.TabIndex = 0;<br />
this.pb.TabStop = false;<br />
this.pb.Paint += new System.Windows.Forms.PaintEventHandler(this.pb_Paint);<br />
this.pb.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pb_MouseUp);<br />
this.pb.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pb_MouseMove);<br />
this.pb.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pb_MouseDown);<br />
this.lblMessage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;<br />
this.lblMessage.Location = new System.Drawing.Point(368, 0);<br />
this.lblMessage.Name = "lblMessage";<br />
this.lblMessage.Size = new System.Drawing.Size(288, 256);<br />
this.lblMessage.TabIndex = 1;<br />
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);<br />
this.ClientSize = new System.Drawing.Size(680, 566);<br />
this.Controls.Add(this.lblMessage);<br />
this.Controls.Add(this.pb);<br />
this.Name = "frmAspect";<br />
this.Text = "frmAspect";<br />
this.Load += new System.EventHandler(this.frmAspect_Load);<br />
this.ResumeLayout(false);<br />
<br />
}<br />
#endregion<br />
<br />
private void frmAspect_Load(object sender, System.EventArgs e)<br />
{<br />
pb.Image = Image.FromFile( @"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg");<br />
pb.SizeMode = PictureBoxSizeMode.StretchImage;<br />
}<br />
<br />
private void pb_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
pb.Cursor = Cursors.Cross;<br />
rctRubber.X = e.X;<br />
rctRubber.Y = e.Y;<br />
Cursor.Clip = pb.RectangleToScreen(pb.ClientRectangle);<br />
bMouseDown = true;<br />
}<br />
<br />
private void pb_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
Cursor.Clip = Rectangle.Empty;<br />
bMouseDown = false;<br />
pb.Cursor = Cursors.Default;<br />
}<br />
<br />
private void pb_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
if (bMouseDown == false) {return;}<br />
pb.Cursor = Cursors.Cross;<br />
rctRubber.Width = Math.Max(e.X,rctRubber.X) - rctRubber.X;<br />
rctRubber.Height = Math.Max(e.Y, rctRubber.Y) - rctRubber.Y;<br />
<br />
pb.Invalidate();<br />
<br />
}<br />
<br />
private void pb_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
if (bMouseDown == false)<br />
{<br />
return;<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
lblMessage.Text = "PB ClientRectange: " + pb.ClientRectangle.ToString()+ "\n" +<br />
"Rubber Rectangle: " + rctRubber.ToString();<br />
<br />
<br />
<br />
<br />
Pen pen = new Pen(Color.Red, 2);<br />
pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;<br />
<br />
e.Graphics.DrawRectangle(pen,rctRubber);<br />
<br />
<br />
}<br />
}<br />
}<br />
|
|
|
|