|
Hi,
i am developing windows dot net 2.0 version application .
my requirement is i have export a form which consists of line, picture, data grid and other control.
so i have export total form to word
please help me this
thanx
|
|
|
|
|
I believe that a form has a method that will draw it to a bitmap. You're going to need some sort of screen capture or otherwise a programatically generated image of your screen, then you will export that to word.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Native BitBlt should be appropriate for that.
Life is a stage and we are all actors!
modified on Tuesday, August 18, 2009 3:09 AM
|
|
|
|
|
I have an aspx page which contains multiple instances of my user control. The user control reads text into a label from an xmlreader.
each instance of the control will read different text.
Im not sure how to access the label.Text property? Do I need to use a delegate to do this? I dont know how this works but would appreciate any help I can get!
|
|
|
|
|
You were looking for the ASP.NET forum ?
It's very simple. If your user control needs to expose an inner property, you write a property to expose it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
Here is my task to accomplish so far: Modify the date class of (provided) to perform error checking on the initializer values for instance variables month, date, and year. Also provide a method NextDay to increment the day by one. The Date object should always remain in a consistent state. Write a program that tests the NextDay method in a loop that prints the date during each iteration of the loop to illustrate that the NextDay method works correctly. I have to be careful that I make sure my program increments into the next month and into the next year.
I did created classes and intiliaze values, and created next day. I tried different method but,could not get it right.Can you point me in the right direction. Thanks, and here is my code:
Date.cs
using System;
using System.Collections.Generic;
using System.Text;
public class Date
{
public static void Main(string[] args)
{
}
private int month, day, year, nextday;
public Date(int theMonth, int theDay, int theYear, int nextDay)
{
Month = theMonth;
Year = theYear;
Day = theDay;
Nextday = theNextDay;
Console.WriteLine( "Date object for date {0}", this );
}
public int Year
{
get
{
return Year;
}
private set{
if (value > 0 && value <= 3000)
year = value;
else
{
Console.WriteLine("Invalid Year ({0}) set to 1.", value);
year = 1;
}
}
}
public int Month
{
get
{
return Month;
}
private set
{
if (value > 0 && value <=12)
month = value;
else
{
Console.WriteLine( "Invalid Month ({0}) set to 1.", value );
month = 1;
}
}
}
public int Day
{
get
{
return day;
}
private set
{
int[] daysPerMonth = { 0, 31, 28, 31, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
if (value > 0 && value <= daysPerMonth[Month])
day = value;
else if (Month == 2 && value == 29 && (Year % 400 == 0 || (Year % 4 == 0 && Year % 100 != 0)))
day = value;
else
{
Console.WriteLine("Invalid day {0} set to 1.", value);
day = 1;
}
}
}
public override String ToString()
{
return String.Format("{0}/{1}/{2}", Month, Day, Year);
}
public string ToDateString()
{
return month + "/" + day + "/" + year;
}
public int getnextDay()
{
//int nextDay = 1;
{
if (day.equals("Sun"))
return "Mon";
else if (day.equals("Mon"))
return "Tue";
else if (day.equals("Tue"))
return "Wed";
else if (day.equals("Wed"))
return "Thu";
else if (day.equals("Thu"))
return "Fri";
else if (day.equals("Fri"))
return "Sat";
else
return "Sun";
for (nextDay=0;nextDay<30;nextDay++)
{
nextDay = 33; // This line will ERROR!
Console.WriteLine("Loop: {0}", nextDay);
}
}
}
//end of file
DateTest.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Date
{
public class DateTest
{
public static void Main(string[] args)
{
Date myDate = new Date();
myDate.nextDate(); // display date
}
}
}
|
|
|
|
|
lopatko wrote: public Date(int theMonth, int theDay, int theYear, int nextDay)
Why would you take a nextDay property ?
I don't see anything that looks like a shot at a NextDay property. Your code needs to add one to the number of days, then check if you've gone over to the next month, and if you have, go back to 1 and increment the month. It also needs to check if this increments the year.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I´m confused (or miss the point complete): Why not use the AddDay Method?
DateTime dt = DateTime.Now;
Console.WriteLine(dt.AddDays(1).ToString("dddd").Substring(0,3));
|
|
|
|
|
SQLValues = SQLValues + " '" + ckbxCreateShortcut.Checked.ToString() + "', '" + ckbxUniqueName.Checked.ToString() + "', '" + rbtnClientMachine.Checked.ToString() + "', '" + rbtnClientUser.Checked.ToString() + "' ";
This one is wrong somehow?
SQLValues = SQLValues + "'{0}', '{1}', '{2}', '{3}' " ckbxCreateShortcut.Checked.ToString(), ckbxUniqueName.Checked.ToString(), rbtnClientMachine.Checked.ToString(), rbtnClientUser.Checked.ToString();
|
|
|
|
|
If I have understood what you are trying to do:
SQLValues += string.Format("{0}, {1}, {2}, {3}", ckbxCreateShortcut.Checked.ToString(), ckbxUniqueName.Checked.ToString(), rbtnClientMachine.Checked.ToString(), rbtnClientUser.Checked.ToString());
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
You put quotes around it, the paramaterised queries take care of that for you.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Is there a way to determine if a type is nullable, other than hitting it with a tryparse (somewhat like hitting something to see if it will break). IE is there a property on the type that indicates if it is nullable.
I have a generic convert from datarow to properties that is stumbling on nulls, I don't particularly want to do a switch on the type but would like to determine if the type property type will accept a null before attempting to load it.
I may need to do the switch eventually to support the hierarchy type
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If you mean, is it able to be null like a string, and not like an int, I believe the answer is no. If you mean is it an instance of an INullable, then 'as' will do that for you.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This thread on MSDN Forums has several methods that claim to be able to do this. Clickety[^].
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks Henry, thats what I was looking for. It's a bit weird when an MVP is asking the same question, there are a number of excellent responses.
|
|
|
|
|
Is it pointless to put a lock around a single line of code like this (e.g. in a 'get' accessor) regardless of how _memberString is set?
lock (_locker)<br />
{<br />
return _memberString;<br />
}
|
|
|
|
|
probably, because there's no changes happening to the string. However, I'd be cautious to give a definitive answer, it really depends on what else the code does. Is it multi threaded ? If not, then yes, it's a waste.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Better safe than not safe.
|
|
|
|
|
Given something like:
class c {
_locker;
_memberString;
f() {
...
lock(_locker) {
return _memberString;
}
}
}
caller() {
c v;
...
s = v.f();
}
In s = v.f() _memberString will need to be copied to a temp variable, or directly to s, before f returns. By locking the return you ensure that _memberString isn't modified in mid-copy ... or at least that's the way I would expect it to work in lieu of documentation to the contrary.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Then the issue is CAN _memberString be modified in mid-copy, under any circumstances? Consider that...
1) Strings are immutable, at least at the level of C# code.
2) _memberString is actually a reference to a string, not the string itself.
References are N bytes (can't remember what N is). Perhaps it is possible that while those N bytes are being copied, the copy could be interrupted and the N bytes overwritten by a new value, so that the reference copied to s is corrupted.
Like the other guy said, better safe than sorry.
|
|
|
|
|
I've probably just been sat in front of this monitor for far too long today (about 14 hours so far ) but I can't figure this out!
Consider this struct which is nothing more than an int wrapper:
public struct MyStruct
{
private int _Value;
private MyStruct(int value)
{
_Value = value;
}
public static implicit operator int(MyStruct instance)
{
return instance._Value;
}
public static implicit operator MyStruct(int value)
{
return new MyStruct(value);
}
public int Value
{
get { return _Value; }
}
} I can treat an instance as an int until trying to work with an array or list that expects an int[]:
MyStruct instance0 = 0;
MyStruct instance1 = 1;
MyStruct instance2 = 2;
MyStruct[] myStructArray = new MyStruct[] { instance1, instance2 };
List<int> intList = new List<int>();
intList.Add(instance0);
intList.AddRange(myStructArray);
int[] intArray = myStructArray; Is there any workaround for this (apart from sleep )?
[Addendum] I've just found this blog[^] that says it can be done, but only with reference types [/Addendum]
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) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Monday, August 17, 2009 6:52 PM
|
|
|
|
|
workaround for first part:
foreach(MyStruct my in myStructArray)
{
intList.Add(my);
}
for the other part i don't know
|
|
|
|
|
Yeah, I can iterate through to do it - *Buffer.BlockCopy would probably do it without the iteration by me, but I figured there was some kind of interface I could implement at the struct level so I could keep the code as is and it would just work.
*[Edit] No it won't, it has to be an array of primitives [/Edit]
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) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi Dave,
IMO an array of something, say X[] myArray can only hold objects of type X or their derivatives; being implicitly convertible to X doesn't count as such conversion would need code execution to happen.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Wait for C# 4.0? (Covariance and contravariance?)
|
|
|
|
|