|
I think I figured out my issue. Here is my code for anyboday else that needs to do the same.
int dayOfMonth = Int32.Parse(monthly1TxtBox1.Text);
int iterativeMonths = Int32.Parse(monthly1TxtBox2.Text);
string matchpattern2 = "(^1?[1-9]$|^[1-2]0$|^2?[1-8]$)";
Regex re2 = new Regex(matchpattern2);
if(re2.Match(monthly1TxtBox1.Text.ToString()).Success == true)
{
int intDays = 0;
TimeSpan tsWeekly = endDateTime.Date.Subtract(startDateTime);
intDays = tsWeekly.Days;
DateTime[] datearray = new DateTime[intDays];
for(int x=0; x < intDays; x++)
{
datearray[x] = startDateTime.AddDays(x);
}
Array.Sort(datearray);
int loopcounter = 0;
int intRecur = 0;
if(occTxtBox.Text.Length > 0)
intRecur = Int32.Parse(occTxtBox.Text.ToString());
int occurNum = 0;
for(int x=0;x < intDays;x++)
{
if(intRecur == 0)
{
if(datearray[x].Day == dayOfMonth)
{
if(loopcounter == 0)
{
//DoWork
loopcounter = loopcounter + iterativeMonths+1;
}
else if(datearray[x].Month == startDateTime.AddMonths(loopcounter).Month)
{
//DoWork
loopcounter = loopcounter + iterativeMonths;
}
}
}
else
{
if(datearray[x].Day == dayOfMonth && occurNum < intRecur)
{
if(loopcounter == 0)
{
//DoWork
loopcounter = loopcounter + iterativeMonths+1;
occurNum++;
}
else if(datearray[x].Month == startDateTime.AddMonths(loopcounter).Month)
{
//DoWork
loopcounter = loopcounter + iterativeMonths;
occurNum++;
}
}
}
}
msg.Text += "<font color=red>Task Added</font>";
posAddEdit = 0;
}
else
{
msg.Text = "<font color=red>Please enter a day between 1 & 28</font>";
}
p.s. pre /pre always eats my for loops
-- modified at 18:23 Wednesday 21st December, 2005 0;
if(rmConn.State == ConnectionState.Open)
rmConn.Close();
}
else
{
msg.Text = "<font color=red>Please enter a day between 1 & 28</font>";
if(rmConn.State == ConnectionState.Open)
rmConn.Close();
}
p.s. pre /pre always eats my for loops
|
|
|
|
|
Joshua Lunsford wrote: string matchpattern2 = "(0[1-9]|[12][0-9]|2[08])";
I am not quite sure what your regular expression is supposed to match on.
0[1-9] matches 01 through 09.
[12][0-9] matches 10 through 29.
2[08] matches 20 or 28. This is already covered by previous.
Do you want it to be 3[0-8]
Also, as it is, this RE will match number in a larger string. For instance, the following string will match on the 20:
34562055
If you only want two characters, try:
(^0[1-9]|[12][0-9]|2[08]$)
Roy.
|
|
|
|
|
i want it to match on 1-28
|
|
|
|
|
Joshua Lunsford wrote: i want it to match on 1-28
Try this:
(^0[1-9]|1[0-9]|2[0-8]$)
PS. Sorry for taking so long. Holidays and all...
Roy.
|
|
|
|
|
Hi Friends
i m having some text fields in page & datagrid. when i click bookmark link, the page as to go up & it as to display from Data Grid.
If any one knows plz tell me the code( in java script or c-sharp code).
Thanking u
bye,
Naren
please help me
|
|
|
|
|
Hello,
I am accessing a shared file through UNC address over LAN. Whenever I do that, the windows login prompt appears. I need to bypass this prompt though C# code. How can I do it?
Regards,
Zishan
|
|
|
|
|
\\server-name\directory\filename
Just try with this, if possible u can get it.
please help me
|
|
|
|
|
Thanks for the reply.. yes right but then I try to access file like this.. a windows login prompt appears and I have to enter username and password manually.. I want this manual thingi to be handled by code. Some way to enter this Windows Authentication.
Regards
Zishan
|
|
|
|
|
Have you tried using System.Diagnostics.ProcessStartInfo? With that, you can supply a user name & password through code, but I don't know if this will work for UNC shares.
|
|
|
|
|
You can try Judah's suggestion. I don't know if it'll work either.
But, if it doesn't, a workaround I know of would be to temporarily map a drive to the share. You can most definately supply the username and password to that.
But, to clarify, there is NO WAY to get around that login box. The machine your connecting to wants to know who is trying to get into that share. That target machine doesn't trust the credentials that your app is running under. There is simply no way of getting around that. But, if the credentials are supplied using a different method, that box won't show up.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks both of you.. I am off from work now.. will try Judah's suggestion tomorrow.
Dave what credentials are you talking about.. can you please elaborate a bit more.. Let me be more precise. I have an application running on Windows XP Professional trying to access a shared file located on a network drive which is running Windows Server 2000. What's that "other method" Can you elaborate?
Thanks
Zishan
|
|
|
|
|
Zishan Haider wrote: what credentials are you talking about
The credentials you used when you logged into Windows on your machine...Username and password. When you try to connect to another Windows machine, those credentials are sent to the remote machine.
If that machine isn't a member of the same domain (if you have one!) as your machine, then it has to rely on its own user accounts to authenticate you. If your username doesn't exist on the remote machine, it'll ask you for an account and password that it knows about, because it doesn't trust the account information it's getting from your machine.
Now, you only have to log into a remote machine once and it'll remember who you are for as long as you are logged into your machine. There are many different ways to get an authenticated connection to a remote Windows machine. The most common is mapping a drive letter to a share on the remote machine. You have to supply a username and password to the remote machine if it doesn't trust you. Since you can't just connect to a remote share without first authenticating to the remote machine, you need to authenticate an account with the remote machine. You can't do that by just connecting to a remote share. There's no way to enter the account information. But, you CAN do it through code if your code maps a drive to the share first. You have to supply the function For example...[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey Dave.. Thanks a lot for your support.. it just solves my problem
|
|
|
|
|
Hi All,
Is there any way by which we can know which particular arrangement of
files and folders is being selected by a user in a particualr folder
view.I mean that among the five
options(Name,Size,Type,Modified,Attributes) which we can chose when we
chose 'Arrange Icons By' options which one is being selected.Any
suggestions will be greatly appreciated.Thanks in Advance.
Rakesh
|
|
|
|
|
Hi friends,
I am currently working on an ASP.NET project using C# and i have one issue. Does anyone know how to trigger a javascript anywhere in C# code.
eg : if(conditon)
trigger javascript
Can you please help me on this.Thank you
Krugger
The Truth is out there...
|
|
|
|
|
You can add javascript using the Page.RegisterStartupScript method.
Example:
Page.RegisterStartupScript("ShowAnswer", "<script type=\"text/javascript\">alert('42');</script>");
---
b { font-weight: normal; }
|
|
|
|
|
Thanks ---
b { font-weight: normal; }
I came across this but was unsure whether the script will run immediately.
Can i do something like this (see below) to ensure that the Javascript ShowAnswer is fired only where MyBool is true?
if(MyBool)
Page.RegisterStartupScript("ShowAnswer", "alert('42');");
Krugger
The truth is out there..
|
|
|
|
|
The code is placed just before the tag, so it will be run while the page is loading in the browser.
If you don't execute the RegisterStartupScript call, the code is of course not added to the page.
---
b { font-weight: normal; }
|
|
|
|
|
hi
I have created a class where I am creating custom control for my web page the problem is that i am getting error like this
The type or namespace name 'UI' does not exist in the class or namespace 'System.Web' (are you missing an assembly reference?
in the using System.Web.UI;
using System.Web.UI.WebControls;
what is the actual cause for this error ? and how i can rectify it I am not good in C#
thanks in advance
kal13na13
|
|
|
|
|
kal13na13 wrote: are you missing an assembly reference?
So... Are you?
See the references section of your project, is there a System.Web reference in there? If not add it by right clicking references, select "Add Reference..." Find "System.Web.dll" in the list (in the .NET Tab), double click it then press okay.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
|
Hello ,
I am a beginner in c#.net, currently i am working on c#.net windows forms.
My problem is i want to call a button event of let's say form1 from form2.
what i did is make an object of form1 and call that button event, but it's not working.
I need your help immediately pls give me ur idea,
alex.
Help me
|
|
|
|
|
SOunds like your application architecture isn't right. You shouldn't be doing this. The button event on form one should be activated only from the button itself. Nothing else should call it.
Some ideas:
Refactor the code for the event into a separate method and call that method from the other form.
Refactor the code for the events into a controller class and have the event handlers call into the controller. The code in the form2 would also call into the controller instead of directly to the form1.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
|
|
|
|
|
yes. i think the same as colin.
But if you want to do this you might declare the event of this button as public instead of private.
But what you are trying to do isnt right.
|
|
|
|
|
Hi, I'm building a text file filter.
I need to verify if a string is part of another string, for example: I wanto to find if the word "text" is part of a string.
I'm writing a class inherited by String class...is it the correct choice or already exists a class to do this?
Sorry for my bad english;P
|
|
|
|