|
hi all
i am inserting date to the text box on the datagrid template.There is 2 column for that. one receive date and the other due date. due date should be greater than receive date. and the date format is dd/mm/yyyy. how to validate this. since the date format is dd.mm.yyyy, am not able to compare it with different month.plz help me to solve this. am doing this from past 4 days. but didnt end up with a solution
sample code is given below
if(((TextBox)(dgDetailData.Items[total].Cells[7].Controls[1])).Text != "")
{
try
{
DateTime txt=Convert.ToDateTime(((TextBox)(dgDetailData.Items[total].Cells[6].Controls[1])).Text);
DateTime tst=Convert.ToDateTime(((TextBox)(dgDetailData.Items[total].Cells[7].Controls[1])).Text);
string date=month+"/"+day+"/"+year;
if(DateTime.Compare(txt,tst)>0)
{
lblmsg.Text="error";
lbl1.Text=date.ToString();
}
else
{
lbl1.Text=txt.ToString();
InsertParam[9].Value=Production.FORMATYMONDTIME(((TextBox)(dgDetailData.Items[total].Cells[7].Controls[1])).Text);
}
}
catch(Exception err)
{
RegisterStartupScript("startup","<script>window.alert('1.Error:"+err.ToString()+"')</script>");
}
}
else
{
InsertParam[9].Value=DBNull.Value;
}
-- modified at 22:46 Thursday 4th October, 2007
|
|
|
|
|
P_Elza wrote: since the date format is dd.mm.yyyy, am not able to compare it with different month
Why not ?
if (txt > tst)
should work just fine.
What's going wrong with this code when you step through it now ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello guys,
is there any way, how can I change IP address and other network settings programmatically ? [using C#, or unmanaged C++].
thanks in advance
VirtualVoid.NET
|
|
|
|
|
Dear all,
Is there a way to put the cursor say Hourglass to appear on form? Like the Disk Defragmenter in Vista, when you click on the "Defragment now" button, an hourglass will be shown at the side of the label "Defragmenting hard disks...".
Additionally, in IE7, while a web page is loading, you can see an hourglass cursor on the edge of the tab.
Many thanks!
|
|
|
|
|
It won't be a cursor, but you can draw anything you like on your form.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
try put image there with some properties like "visible" which will be set to true (and then displayed) when some action is processed
VirtualVoid.NET
|
|
|
|
|
Set Form.Cursor=Cursors.WaitCursor and hover the form...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi
I want to use circular buffering technique for transmission of video over LAN.But I m not getting help in its implementation in C#.Plz if any1 did work with this technique then Help me Out.
Thanx.
Shanzay
|
|
|
|
|
Is google broken where you are?
It works fine[^] for me.
|
|
|
|
|
Ofcourse At 1st I searched there but didnt get exact info. related to LIVE video then asked.THANX.
Shanzay
|
|
|
|
|
hai, I've got question about RTB Controller in C#
I need to "hide" some of text in RTB Controller. I'm thinking of using TreeView Controller so if the user wants to "unhide" they just expand the treeview.
is it possible to add another control like treeview controller in RichTextBox?
if not possible, is there another way to hide some text in RTB Controller?
regards
~erwin~
Mail me at erwin@holyknight.us
|
|
|
|
|
Hi All,
I’m new to C#, however I’m willing to learn it everyday. I'm trying to create a simple program that will run in console mode. Below is the objective and what I have done so far.
Objective:
To check if the remote host are online in the network resolved by using WINS lookup and sent ping request to get reply status, using ip address get from nblookup.exe. I manage to get first part run. Now I want to process the output of the "nblookup.exe" and get the ip address in a variable to use later in ping command.
Can anybody kindly guide me on how to do this? Really appreicate your help in advances. Thanks
regards,
dinidamia
My Sample Code:
-------------------------------------------------------
using System;
using System.Diagnostics;
namespace program
{
class program
{
// args[0] must be hostname.
static void Main(string[] args)
{
if (args.Length == 0)
{
//If user did not enter any Parameter inform him
Console.WriteLine("Usage : program <hostname> ");
return;
}
else
{
string sUserInput = args[0];
QueryWinsSrv(sUserInput);
}
}
#region
// QueryWinsSrv:
// Run nblookup.exe against remote host
// If the hostname resolved in WINS
// ping remote host using ipaddress found in WINS
static void QueryWinsSrv(string sRemoteHostname)
{
Process p_nblookup_cmd = new Process();
p_nblookup_cmd.StartInfo.FileName = "nblookup.exe";
p_nblookup_cmd.StartInfo.Arguments = "-s 10.88.8.3 " + sRemoteHostname;
p_nblookup_cmd.StartInfo.UseShellExecute = false;
p_nblookup_cmd.StartInfo.RedirectStandardOutput = true;
p_nblookup_cmd.Start();
string nblookup_cmd_output = p_nblookup_cmd.StandardOutput.ReadToEnd();
Console.WriteLine(nblookup_cmd_output);
p_nblookup_cmd.Close();
}
#endregion
}
}
-------------------------------------------------------------
Program Output:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\program.exe JOE_WXP1
Recursion is on
Querying WINS Server: 10.88.8.3
NetBIOS Name: JOE_WXP1
Suffix: 20
Name returned: JOE_WXP1
Record type: Unique
IP Address: 10.88.8.20
|
|
|
|
|
Look into the RegEx Class[^]
You can also Google for Regular Expression examples on how to find IP Addresses.
|
|
|
|
|
Hi All,
Iam having two tables
table1
1.Rno Primary key
2.name
3.empid foreign key of table2
table2
1. empid primary key
2.address
3.Rno foreign key of table1
Here Rno and empid are auto generated. Now i want to insert data into first table i need sql query for this.Please help me on this
i want to join this group
|
|
|
|
|
It should be something like:
INSERT INTO table1 (name,empid) VALUES ('string for name',int empid)
|
|
|
|
|
Hi,
Thanks for replying.But the problem is empid and rollno both are auto generated
If i want to insert into table1. i need empid.But empid is generated when ever we pass rollno to table2.Please help me on this.
i want to join this group
|
|
|
|
|
You have to select empid first like:
Select empid from table2 where name like '%ABC%'
by executing it
int id = convert.toInt32(cmd.ExecuteScalar())
then
inser into table1 (name, empid)value("XYZ",'+id+')
cmd.ExecuteNonQuery
that's way u get ur task.
it is more robust if u use Transaction here.
bye
|
|
|
|
|
Hi,
The main problem is if i want to access empid.i need a rollno.But in table1
if i want to insert rollno,i need empid.both rollno and empid are auto generated and primary key in table1 and table2.
i want to join this group
|
|
|
|
|
Right - first of all, this isn't the right forum for this. There's a SQL forum here on CP that would be better suited for this.
Secondly - please use a different post title. Everybody's query is urgent - nobody ever says, "take your time and get back to me when you can". There are guidelines that should be followed when posting to the forums; they can be found here[^].
Now - to insert into a table with an autoincrement, you miss the autoincrement out of the field list, so in the case of this you would do
INSERT INTO Table1(name, empid) VALUES (...,...) Now, you have a circular reference between the two tables. Is this what you really want?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Thanks for giving suggestions.Iam new to this forum.I will post same message in sql forum.Yes iam having circular reference.
i want to join this group
|
|
|
|
|
It looks like your purpose is to have roles list ant employees list and you need some how to assign roles to employees.
If this is the case - I would have done this with three Tables.
TableEmps -- empId, empName (PK - empId)
TableRoles -- roleId, RoleName (PK - roleId)
TableRoleToEmp -- roleId, empId (FK1 roleId ref - TableRoles.roleId, FK2 empId ref - TableEmps.empId)
|
|
|
|
|
Hi All
Please help me.
I am developing an intranet application, it has page that shoul donly be access by certain people, to do this I used the Page.User.Identity.Name.
The problem is when Irun the application on my local computer Page.User.Identity.Name
returns my user name in the format domain/username.
However when I upload the page to the server Page.User.Identity.Name. returns
an empty String.
What is the possible cause of this and waht is the solution to it.
Please help!
Thank You in advance.
khuzym
|
|
|
|
|
Disable anonymous browsing on the site.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thank you so much Guffa, you solved my problem.
khuzym
|
|
|
|
|
Hi Dears!
I m displaying amount in datagridview while editing the amount, i have to check whether user enter negative value if so prompting it and setting focus back to the amount cell;
i try hard such as:
dataGrid.SelectedRows(0).Cells(0).Selected = True,
DataGridView dv;
dv.CurrentCell = new DataGridViewCell(row_index, col_index);
dataGridview.SelectedRows[e.Row].SelectedCells[2].Selected = true;
but all in vain so far; if any one have idea regarding this so please tell me.
Thanks in advance.
|
|
|
|