|
i registered the click event ...
and i'm using VS.Net ...
|
|
|
|
|
What's the error you got? There are a lot of unknowns in this method. It's hard to tell if something is supposed to be a local var or a class property. You would probably be better off posting the C# line that has the problem.
Michael Flanakin
Web Log
|
|
|
|
|
I may be wrong, but this smacks of someone asking for help on a homework assignment...
|
|
|
|
|
I'm glad I wasn't the only one to think that.
Michael Flanakin
Web Log
|
|
|
|
|
And there's nothing wrong in providing help to him. What's wrong is doing his homework...
That's why I asked him what he tried, so I can point him some minor error and let him follow his path...
Perl combines all the worst aspects of C and Lisp: a billion different sublanguages in one monolithic executable. It combines the power of C with the readability of PostScript. -- Jamie Zawinski
|
|
|
|
|
It is an examn assignment ...
but i'm really bad in these things , ...
so any help is good help
|
|
|
|
|
this is what i have in c# ...
but it doesn't work ... :s
I think i'd better work with an arraylist ... but don't know exactly how ...
private void Command1_Click()
{
int x = 0;
int var1 = 0;
int var2 = 0;
List1.Clear();
x = Microsoft.VisualBasic.Conversion.Val(Text1.Text);
varX = Microsoft.VisualBasic.Conversion.Int(x / 3) + 1;
var1 = 1;
var2 = 1;
var3 = 1;
while (! (var1 == x))
{
tel = tel + 1;
getal1 = var1;
var2 = var2 + 1;
getal2 = var2;
getal3 = Microsoft.VisualBasic.Conversion.Val(x) -
Microsoft.VisualBasic.Conversion.Val(getal1) -
Microsoft.VisualBasic.Conversion.Val(getal2);
if (getal1 != getal2 & getal1 != getal3 & getal2 != getal3 & getal2 < getal3)
{
List1.AddItem getal1 + " + " + getal2 + " + " + getal3;
}
else
{
var1 = var1 + 1;
var2 = var1;
if (tel == var3 + 1)
{
break;
}
var3 = tel;
}
}
}
}
}
|
|
|
|
|
if tried some more ... there are a lot of wrong things in it but, hey ... who's perfect ?
maybe if i keep on trying, i'll get there ...
private void Command1_Click()
{
ArrayList getal = new ArrayList();
int x = 0;
int var1 = 0;
int var2 = 0;
List1.ClearSelected();
x = Convert.ToInt32(Text1.Text);
varX = (x%3)+1;
var1 = 1;
var2 = 1;
var3 = 1;
while (! (var1 == x))
{
tel = tel + 1;
getal1 = var1;
var2 = var2 + 1;
getal2 = var2;
getal3 = getal3 = Val(x)- Val(getal1)- Val(getal2);
if (getal1 != getal2 & getal1 != getal3 & getal2 != getal3 & getal2 < getal3)
{
List1.Items.Add(getal[i].ToString());
}
else
{
var1 = var1 ++;
var2 = var1;
if (tel == var3 ++)
{
break;
}
var3 = tel;
}
}
}
}
}
|
|
|
|
|
Hi,
I am developing C# programs nowadays, I want to enter game programming with DirectX9 and C#. Can somebody give a good starting point (book, web source or some other source)?
Thank you all.
Cem Louis
|
|
|
|
|
|
I'll second the suggestion of Introduction to 3D Game Engine Design...full of information.
And, with some smart optimizations, you can whittle away that 20% slowdown...not to equal native, mind you, but it is "optimizable"
|
|
|
|
|
I have got a datagrid. The datasource of this datagrid is a datatable in a dataset ...
In the datagrid, i have got my combobox added in it and some boolean cells ....
The problem i met is that when i changed the value from a cell ... the dataset didn't updated immediately and kept on the obsolete data .... but when move my mouse focus to another cell and change the value .... the previous modification made to the datagrid has not updated to the dataset .......
What is the problem actually ? .. Any help will be appreciated .
|
|
|
|
|
I'm trying to write this class to filter urls from asp to aspx pages but it looks like .Net doesn't deal with .asp pages any more. Could you please suggest any alternative to this or how to make it work?
Thanks a lot.
Here is the code I'm using in the class:
using System;
using System.Web;
using System.Xml;
namespace URLChanger
{
///
/// Summary description for Class1.
///
public class ChangeURL : IHttpModule
{
///
/// Init is required from the IHttpModule interface
///
/// <param name="Appl" />
public void Init(System.Web.HttpApplication Appl)
{
//make sure to wire up to BeginRequest
Appl.BeginRequest+=new System.EventHandler(Rewrite_BeginRequest);
}
///
/// Dispose is required from the IHttpModule interface
///
public void Dispose()
{
//make sure you clean up after yourself
}
///
/// To handle the starting of the incoming request
///
/// <param name="sender" />
/// <param name="args" />
public void Rewrite_BeginRequest(object sender, System.EventArgs args)
{
//process rules here
//cast the sender to an HttpApplication object
System.Web.HttpApplication Appl=(System.Web.HttpApplication)sender;
string fullUrl = Appl.Request.Url.AbsoluteUri.ToLower();
string urlPath = Appl.Request.Path.ToLower();
string[] folders = urlPath.Split('/');
string filename = urlPath.Substring(urlPath.LastIndexOf('/')+1);
string file = filename.Substring(0, filename.IndexOf('.'));
string ext = filename.Substring(filename.LastIndexOf('.')+1);
string parms = Appl.Request.QueryString.ToString();
string dest;
if((Appl.Request["tag"]) == null)
{
if(folders.Length > 3)
{
string fld = folders[2].ToString();
//System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
//doc.Load("http://localhost/URLCHangerDemo/xmlfile1.xml");
//string srch = "/Dealers/PowerPage[@url='" + folders[2].ToString() + "']";
//System.Xml.XmlNode foundNode = doc.SelectSingleNode(srch);
dest = "http://devweb.trader.ca/" + folders[2] + "/" + folders[3] + "?" + parms;
Appl.Response.Redirect(dest);
}
}
}
}
}
|
|
|
|
|
You have to configure IIS to use the aspnet_isapi.dll ISAPI filter to handle the .asp extension as well. You can do this by opening the Internet Information Manager from your Administrative Tools directory, get the Properties for the site and go to the Home Directory tab. Click on Configuration... and see how the others are configured.
ASP.NET is an ISAPI filter so it can only handle files that are associated with that ISAPI filter. ASP.NET never did handle .asp files, so here you'll have to re-associate .asp files with the ASP.NET filter.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for reply.
Actually I did that and now when I try to see any .asp page I get this error:
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.asp' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested Url: /mysite/WebForm2.asp
Any idea how to fix it.
Thanks.
|
|
|
|
|
That's because by default the machine.config file associates the .asp extension with the System.Web.HttpForbiddenHandler . Either change this in your machine.config (not recommended in most cases) or add the mapping in your application's root Web.config file.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Could you please give me an example of this mapping in web.config file?
Thanks.
|
|
|
|
|
It's all in the documentation for the <httpHandlers> configuration section. For example:
<httpHandlers>
<add verb="*" path="*.asp" type="MyNamespace.MyHandlerClass"/>
</httpHandlers>
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have the following entry in web.config:
<httpmodules>
<add type="URLChanger.ChangeURL,URLChanger" name="URLChanger">
Should I add another one or update this one?
I'm kinda new to this stuff.
|
|
|
|
|
Sorry, here it is:
I have the following entry in web.config:
<httpModules>
<add type="URLChanger.ChangeURL,URLChanger" name="URLChanger" />
</httpModules>
Should I add another one or update this one?
I'm kinda new to this stuff.
|
|
|
|
|
Oops, cross my handlers with my modules again. I corrected the code, but your IHttpModule implementation has nothing to do with the handler for the .asp files, which leads me to ask what are you trying to do?
To remove the HttpForbiddenHandler for the .asp file, you need to add this in your Web.config (don't duplicate the >httpHandlers> section obviously):
<httpHandlers>
<remove verb="*" path="*.asp"/>
</httpHandlers>
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Great!!!! I really appreciate the help.
It worked but I still need to test the full project I'm working on.
What I'm trying to do is that my company has a list of customers who have their mini sites on our server. For example http://www.mysite.com/customer1/default.asp. Most of the customers have this link on their business documents.
We have 2 domains pointing to same IP. Let's say you type www.mysite.com or www.mycompany.com and both goes to same location.
Now my company is making one domain a whole different site but they don't want to bother customers to change their mini site location.
So, my project is to check the url on new domain and if the url has a customer folder name within, I should redirect it to other domain to correct url. All the pages are in .asp
I'm planning to have all the customer folder names in one XML file and use HttpModule class to check the folder name in XML file and redirect it. THe challenge here is that if url doesn't have matching folder in XML it should'n do anything and display the file from local server.
I don't know if you have any interest in this but if you do I can bug you again in case I get stuck somewhere.
Many thanks for your help.
|
|
|
|
|
When you anchor two opposing sides, the control is stretched so that the distance between the parent's edges and the child's edges remain the same.
Anchoring and docking doesn't always solve the problem, though, in cases where you need to resize two controls adject to each other and retain the same relative widths, and in similar cases. Just handle the Resize event of the parent control (or override OnResize in your parent control if you want the parent to resize the children) and adjust your sizes and locations accordingly.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Try the documentation. You'll see the Resize event that's inheritted from Control . To get the size of the parent, simlpy get it Size property. You'll need a reference to the parent, which is why the Parent property is inheritted from all controls. So just call Size size = Parent.Size in the Resize event handler and adjust your Size and Location accordingly. You only need to do this, though, if anchoring doesn't give you the layout you need. Try anchoring first. If you need more information on anchoring, check the documentation for the Control.Anchor property in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Yes, but you have to handle the event in your child controls.
Microsoft MVP, Visual C#
My Articles
|
|
|
|