|
hello,
i want to show 5 days before current date and 20 days after current date in a calender control with every date link to a particular page.
plz give me any sample code.
regards
aurosikha
|
|
|
|
|
Windows Forms does not have a Calender control (it does have DateTimePicker), so I suggest you head off to the ASP.NET message board.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
I know how to insert images to PDF but i need to how can we insert image and image name below it in PDF using C# or Vb or VB.net
RamyaNaidu
|
|
|
|
|
Contact the supplier of your PDF library.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - coming soon ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
|
Use an interface. Simple example below.
public interface IMyInterface
{
void WriteMe();
}
public class A : IMyInterface
{
public void WriteMe()
{
Console.Write("A");
}
}
public class B : IMyInterface
{
public void WriteMe()
{
Console.Write("B");
}
}
public class C : IMyInterface
{
public void WriteMe()
{
Console.Write("C");
}
}
public class D
{
public void WriteParameter(IMyInterface test)
{
test.WriteMe();
}
}
Then you can do this
D d = new D();
d.WriteParameter(new A());
d.WriteParameter(new B());
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Thanks a lot Dave this code worked for me.
|
|
|
|
|
If I understand what you want (and I probably don't), what you want to do is called oveloading.
public class A
{
private List<a> list = new List<a>();
public List<a> GetAllRecords() { get { return list; } }
}
public class B
{
private List<b> list = new List<b>();
public List<b> GetAllRecords() { get { return list; } }
}
public class C
{
private List<c> list = new List<c>();
public List<c> GetAllRecords() { get { return list; } }
}
public class D
{
private A a = new A();
private B b = new B();
private C c = new C();
private List<a> aList;
private List<b> bList;
private List<c> cList;
public D()
{
}
private List<a> GetAllRecords(A a)
{
aList = a.GetAllRecords;
}
private List<b> GetAllRecords(B b)
{
bList = b.GetAllRecords;
}
private List<c> GetAllRecords(C c)
{
cList = c.GetAllRecords;
}
}
[EDIT] Forgot to convert the pointy brackets...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Saturday, October 11, 2008 5:08 AM
|
|
|
|
|
Hello friends,
I'm using Visual Studio 2005. I'm developing an application that extracts icons from .exe and .scr files and saves them into a MS-Access database. I've created a OLE Object field in the database table for the icons. I use the Icon.Save() along with an instance of the MemoryStream class to get raw icon data bytes into an array. My problem is that Icon.Save() method saves the icon as a 16-color image. I want to know how can I save the icon with no quality loss.
Also, are there any alternatives to the MemoryStream class?
Many thanks in advance.
|
|
|
|
|
hi
this is a good example for loading and saving icons.
http://www.codeproject.com/KB/cs/IconLib.aspx
regards
|
|
|
|
|
Can any body in which situations we use value type and for which situations we use reference types for passing parameters to function.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
i think when u have simply to do some calculations or just require temprerory variable to do ur oprations then u can go for value type
and if u want to reuse the same object among diffrent functions which have
dependency on operation done on that object by other funcions then u should go for reference type.
rahul
|
|
|
|
|
If you want the value from outside the function to be changed within the function, use a reference type.
If you want to pass a value from outside the function but not let the function change the original then it needs to be a value type or a clone of the reference type.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi Dave,
If i pass parameter as reference type, for eg. if i pass every thing as ref type then is i am saving memory because no extra memory is required in heap , if i pass parameter as ref.
Tell me i am correct or not.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
I'm no expert in stack/heap stuff, so if what I type below is erroneous, would one of the CP gurus please correct it!
Value types are placed on the stack, reference types are placed on the heap but the reference to them are placed on the stack. A method's parameters are placed on the stack - either a copy of the value type, or a copy of the reference to the reference type, therefore the heap doesn't come into the equasion at all.
Extra stack space is taken whichever way you do it. Reference will be more efficient if you would otherwise be passing large structs (value types), but the stack is very efficient so I wouldn't worry too much.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
You inspired me to read up on this a little!
This[^] is a well explained article. Hope you find it to be of some use.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
This article supports that if you pass very big collection then u should pass by reference.
Am I rite.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Yeah. If passed by value, data is copied and you don't want to be creating multiple copies of a large amount of data. In that scenario it's better to pass by reference so only a copy of the reference is made.
If it's only a small amount of data then there may be a performance advantage to using a struct to keep the heap and GC out of it altogether.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi
I have a windows service application that reads service 'StartTime' , 'IntervalTime' from configuration file and runs my method that do the job at specified time and time intervals. That works absolutely fine by reading the start time and Interval Time (interval time to wait to run the service again).
But the problem is when yearly timings changes. In United Kingdom we get timings change twice explained below for this year. This varies year to year:
Clocks went forward one hour on Sunday 30 March 01:00 GMT* (02:00 BST)
* As the UK is currently on GMT, we changed our clocks at 1 am on Sunday 30 March.
Clocks moved one hour backwards. Sunday 26 October 02:00 BST** (01:00 GMT )
**As the UK is currently on BST (British Summer Time), we will change our clocks at 2 am on Sunday 26th October.
How it works just now:
Currently my service starts at start Time specified in configuration file and again after specified interval Time in config file. For example 1000 is start time and interval Time[should be specified in milli seconds] is 86400000[Equals 24hrs]. My service starts at 1000 Today and runs and then sleep for 24hrs AGAIN runs at NEXT DAY 1000. During this 24hours sleeping if day light time is changing, my service will be out of sync.
Only change i like to be done is: Timer object checks system time every minute to find out if it is the time to run the service or not. That way we can hanlde day light savings time changes i think.
Note: May be by checking time every minute to see if current Time is the Time to run the service method or not.
1 public partial class myService : ServiceBase
2
3 {
4
5
6
7 System.Threading.Timer timer;
8
9 public myService()
10
11 {
12 InitializeComponent();
13 }
14
15 protected override void OnStart(string[] args)
16
17 {
18
19 try
20
21 {
22
23
24
25 string startTimeString = ConfigurationSettings.AppSettings ["StartTime"].ToString();
26
27
28
29 DateTime startTime;
30
31
32
33 int millisecondsToStart = 0;
34
35 if (DateTime.TryParseExact(startTimeString, "HHmm", CultureInfo.InvariantCulture, DateTimeStyles.None, out startTime))
36
37 {
38
39 if (DateTime.Now > startTime)
40
41 startTime = startTime.AddDays(1);
42
43 millisecondsToStart = (int)startTime.Subtract(DateTime.Now).TotalMilliseconds;
44
45 }
46
47 timer = new System.Threading.Timer(OnElapsedTime, null, millisecondsToStart, Convert.ToInt32(ConfigurationSettings.AppSettings["intervalTime"]));
48
49
50 }
51
52 catch (Exception ex)
53
54 {
55
56
57
58 System.Diagnostics.EventLog.WriteEntry("error in starting my Service", ex.Message + Environment.NewLine + ex.StackTrace);
59
60 }
61
62 }
63
64
65
66 protected override void OnStop()
67
68 {
69
70
71
72 }
73
74 private void OnElapsedTime(object source)
75
76 {
77
78
79
80 TransferData();
81 }
|
|
|
|
|
In the UK, although the date changes, the daylight saving time changes at 1am/2am on the LAST Sunday of March and October, so you should be able to detect when it happens.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks for your reply Bob.
I like to write a generic service that handles day light savings. It doesn't matter when it will change.
Service needs to check system time every minute to find out if it is the time to run the service or not. That way even day light savings time changes, service runs at correct time without out of sync.
|
|
|
|
|
Is it possible to test and debug source code which deals with UI and non-UI thread exceptions using Application.ThreadException and AppDomain.CurrentDomain.UnhandledException events?
Regards,
matixsc
|
|
|
|
|
|
I'm not aware of a "space bar button" and I certainly don't have and ASAP.
Asking for an answer ASAP is rude. You need to clarify what you are clicking.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
sachinss1986 wrote: ASAP
Naughty - advice for your future at codeProject - don't use ASAP or Urgent or anything similar. Just ask your question politely with plenty of detail (but not too much) and your far more likely to get a quick answer.
I'm not sure why your rows are deleting. I don't use the dgv myself so not much experience with it but I'm sure it's not the default behaviour so maybe you have KeyDown/Up/Press handler somewhere that's doing this?
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|