|
i want code for a program:
i want to enter a number in between 4000 and 8000.also that entered number must contain a digit 2.otherwise it show invalid. eg:4002,4012,5222.
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:47am.
|
|
|
|
|
thanks for your kind reply.
I am a fresher in this field..
Can u please give me a detailed explanation?
Then it will be very helpful to me...
|
|
|
|
|
And I want money
Anyway here's one way to do it:
1)Check if number is between 4000 and 8000
2) If so then check if it contains a "2". Something like this:
string nr = yourNumbert.ToString();
if(nr.Contains("2")){//do stuff
else{//complain about it
|
|
|
|
|
thanks for your kind reply.
I am a fresher in this field..
Can u please give me a detailed explanation?
Then it will be very helpful to me.....
|
|
|
|
|
thanks for your kind reply.
I am a fresher in this field..
Can u please give me a detailed explanation?
Then it will be very helpful to me...
|
|
|
|
|
thanks for your kind reply.
I am a fresher in this field..
Can u please give me a detailed explanation?
Then it will be very helpful to me....
|
|
|
|
|
It's getting Exam Time Again... Bram van Kampen
|
|
|
|
|
Unfortunately, I'll have to work hard and save up.
|
|
|
|
|
Good Morning,
When my application opens, it checks a version number from an online database to determine if it is using the most current version available. If not, I need it to be able to download the most current version from an online server and then install the application update automatically. I know we see examples of this every day, such as security updates in Windows or online checks for anti-virus programs. The check and automatically close if not installed are already working fine and return a Boolean. How do I force and install the download?
Thank You, Pat
|
|
|
|
|
|
Thank for your answer. I have marked it as correct for this issue. I was able to use it to get the string of code that I needed to resolve the download problem. Now, I need to be able to find a way to automatically install the download. Best Regards, Pat
|
|
|
|
|
Hi all,
I have a NOOB question, when developing a custom user control how can you reference other classes or use a partial class? For some reason when I try to reference another class it can not find it. I tried using the same namespace in the separate class file and tried putting it in the bin directory without any luck. Thanks for the Help!
-Andy
|
|
|
|
|
If the class is in another assembly you must remember to add a reference before it will be available.
Perhaps if you showed a bit of the code we could evaluate it. And don't forget to format the code using the pre tags. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks Mark, I was hoping it was something simple, sometimes the easiest things give you the most problems, here is a layout of my code....
myControls.ascx.cs:
namespace myControls
{
public partial class MyUserControl : System.Web.UI.UserControl
{
public MyEnum myEnum;
protected void Page_Load(object sender, EventArgs e)
{
(.......)
}
}
}
myControls.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="myControls.ascx.cs" Inherits="myControls.MyUserControl" %>
<div>
</div>
myControls.Support.cs
namespace myControls
{
public enum MyEnum
{
Day,
Week,
Month,
}
} Thanks again,
Andy
|
|
|
|
|
You need to include the namespace of that class in your project (if it is under a different namespace).
For e.g.
using System;<br />
using System.input;<br />
using myNamespace;
OR
alternately you could just try
new myNamespace.myClass() .Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Abhinav,
I tried referencing the namespace but the main problem is the User Control can not find the separate class file. Everything works right when I include the Enum in the same file but when I try to use it it gives me errors that it can not find the assembly or reference.
Thanks
Andy
|
|
|
|
|
I saw your code (pasted above).
See a note here[^].
"The partial modifier is not available on delegate or enumeration declarations."Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
modified on Wednesday, February 10, 2010 10:09 AM
|
|
|
|
|
I don't fully understand your query - but are you just missing a project reference? As in solution exporer, project, references -> add reference? Regards,
Rob Philpott.
|
|
|
|
|
Rob,
All of these files are in the same Project I have a UserControl and a class in a separate file but the UserControl can not find the class. I tried putting all of these in the same namespace and tried to use the namespace (using myNamespace.UserControl) without any luck. I'm sure it is a simple fix but I am new to C#. It's not as easy as including a C/C++ header file.
-Andy
|
|
|
|
|
So (for my clarity) - you have a single project file which consists of various source files. Your custom control comprises just another set of source files in this project? What do you mean 'in a seperate file'?
I'm afraid I'm completely lost, but if it is just a namespace issue, get Visual Studio to resolve the namespace by doing a context menu on the type where the error arises and doing 'resolve namespace' (or something like that).Regards,
Rob Philpott.
|
|
|
|
|
Rob,
Sorry for not being very clear....
In my project I have:
myUserControl.ascx
|->myUserControl.ascx.cs
myUserControlSupport.cs
myUserControlSupport.cs Contians Enum that I want to use in myUserControl but myUserControl does not see it and I am lost on how to reference it. I have the same namespace and a partial class defined but it still does not see it.
Thanks for the Help!
-Andy
|
|
|
|
|
And just to make things even more clear ( ).. You get a compilation error, so it is not a matter of the Intellisense not keeping up with you and your classes?
|
|
|
|
|
Yes that is correct, I was getting Errors when I tried to compile.
-Andy
|
|
|
|
|
Well, that should work. Dunno. The enum is publically visible? Regards,
Rob Philpott.
|
|
|
|