|
|
to get text from a textbox you just call textbox.text. But i'm not understanding, you have this code in the "Page.Load" event, how can anyone type in a contact in the textbox if this code executes when you first visit the page?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
1 - ask ASP.NET questions in the ASP.NET forum
2 - just use the text property, obviously
3 - have you considered using better variable names than gridview1 ?
4 - have you considered not putting database code in your presentation layer ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How can I update the contents of my PAD file automatically.
I need to update the following
+ Program Version from Assembly Version of the main exe
+ Release Date based on the current system date
+ Size of the Zip file containing my project exe and data files
I understand this would require some parsing of PAD files. What I'm looking for is a tool which can help me do that. If there is none I may write my own utility.
Thanks
Sukhjinder...
Mods, please move this post to the correct forum
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
i think for your first and second question you should expand the 'properties' folder from solution explorer and double click on 'AssemblyInfo.cs'. you can change what you want there.
|
|
|
|
|
In my program the exe's version number is being auto generated via the statement [assembly: AssemblyVersion("0.8.2.*")]
So I'm not concerned about it.
What I want is that the latest version number, Release date be auto updated in my PAD file...
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
What are you trying to accomplish exactly? Create a PAD file for your project automatically when you build it?
I.e. you click one button it zips it all up, creates the PAD file and zips everything up?
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
I've already created a utility which copies and zips up my project files. What I really need is some tool which can update my PAD file by reading the project exe.
Updations to be made in PAD file are
1) Program version read from project exe
2) Release date, current system date
The tool just needs to parse the PAD XML data and update it with the latest exe information.
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
1) You can get the version from an executable project.exe with this code:
private static Version GetVersion(string assemblyUri)
{
Assembly assembly = Assembly.LoadFile(assemblyUri);
return assembly.GetName().Version;
}
2) This is a little more complicated, you can extract the build date from the assembly provided that you leave the AssemblyVersion in the format x.x.*.* where the *s are replaced by the compiler. There's a discussion about it here[^].
Personally I'd to the last suggestion and create a custom build event to embed it into the assembly, it's the most reliable method.
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Thanks for the help. It seems I'll have to write my own utility.
Thanks...
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
After a little searching you don't have to, from Jeff's blog entry[^].
I put together the following class:
public class BuildInformation
{
private static readonly DateTime BuildOrigin = new DateTime(1970, 1, 1, 0, 0, 0);
private const int peHeaderOffset = 60;
private const int linkerTimestampOffset = 8;
private DateTime _BuildDate;
public DateTime BuildDate
{
get { return this._BuildDate; }
set { this._BuildDate = value; }
}
private Version _Version;
public Version Version
{
get { return this._Version; }
set { this._Version = value; }
}
private static DateTime GetBuildDate(string path)
{
byte[] b = new byte[2048];
using (FileStream fs = File.OpenRead(path))
{
fs.Read(b, 0, 2048);
fs.Close();
}
int i = BitConverter.ToInt32(b, peHeaderOffset);
int secondsSince1970 = BitConverter.ToInt32(b, i + linkerTimestampOffset);
DateTime dt = BuildOrigin.AddSeconds(secondsSince1970);
dt = dt.AddHours(TimeZone.CurrentTimeZone.GetUtcOffset(dt).Hours);
return dt;
}
public static BuildInformation Read(string path)
{
DateTime buildDate = GetBuildDate(path);
Version version = Assembly.LoadFrom(path).GetName().Version;
return new BuildInformation(buildDate, version);
}
private BuildInformation(DateTime buildDate, Version version)
{
this.BuildDate = buildDate;
this.Version = version;
}
}
Hope that helps, things could be tidied up a bit for example using an AppDomain to unload the assembly once it's been loaded etc but this should suffice for most cases.
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Thanks I'll review it and soon provide a little something which we can use to update our PADs with latest Version and Date.
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
hi friends,
1- I want to have my current desktop wallpaper as an image and start processing it like a simple image importing through 'PictureBox'. how is that?
2- and how can i have the address of the current wallpaper in the hard drive?
modified on Saturday, June 7, 2008 8:05 AM
|
|
|
|
|
If your on Windows XP then the wallpaper is always here "C:\Documents and Settings\*user*\Local Settings\Application Data\Microsoft\Wallpaper1.bmp" " and is always a bitmap file.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
i didn't know that. thanks a lot.
|
|
|
|
|
Hi friends
can any body tell me why we use attribute on Classes or Function
Like this
[attribute]
Class test
{
}
or
[attribute]
function abc
{
}
thanx for advance
wasim khan
|
|
|
|
|
|
Hi friends i want that when ever some body click the the close button of my form it should be minimize to System tray. i done all the work but i can not know how to handle the close (X) button so that user click it thee form should be minimize not closed.
wasim khan
|
|
|
|
|
in the FormClosing event use
e.Cancel = true;
this.WindowState = FormWindowState.Minimized; Don't forget to give your users another way to close the form though! Maybe set a flag (bool allowClose ) that is checked in this event so it's only minimized if the flag is false.
if (!allowClose)
{
e.Cancel = true;
this.WindowState = FormWindowState.Minimized;
}
Dave
|
|
|
|
|
Bingo!!!!!!!
thanx Dave its work.
wasim khan
|
|
|
|
|
No problem
Dave
|
|
|
|
|
Hi,
All of you must have herd of Best fit also, but i would give a brief , just in case.
Say i have slots of 50 KB, and there are some codes of different sizes say [10KB,11KB,23KB,34KB,2KB,28KB,31KB,9KB]
Now i have to fit all the elements in the different 50KB Slots such that i make the optimum use of the space. Like:
31+9+10 = 50KB --- 1st slot.
11+34 = 45KB --- 2nd slot...
I need an algo for the same in C#..
Thanks in advance...
|
|
|
|
|
First, you have to define "optimum use". Obviously it's the least number of slots, but what is the optimum distribution of the free space?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You don't define "best fit" based on your needs (i.e. largest first, most-used first, etc) but, based on your example, I'll assume you need a solution to what is called a "bin packing problem" (see google.com). A bin-packing problem solves the problem of fitting different-sized objects (data) into a number of specifically-sized containers without being able to split objects between containers.
The solution you choose will depend on your requirements. The optimum solution (the absolute best possible fit) is computationally complex with longer execution times. A "good enough" solution will be simpler and will likely run in the amount of time you need to complete the task.
Here are some of the simpler solutions:
1. First Fit Decreasing - Sort the items (largest first), then place each item in the first container it will fit in.
2. Best Fit Decreasing - Sort the items (largest first), then place each item in the container that leaves the least room left over (tightest fit).
With these two algorithms, you should need no more than ~120% + 1 more containers than the optimal solution. If you don't sort the items first, I think you need 170% + 1 (or 2?) more containers than the optimum solution.
Best solutions depend on how big the items are in relation to your container (lots of little items in large container or larger items in "close fit" containers) and how much the item sizes and container sizes vary. Then you have to worry about whether you will be adding and removing items on an on-going basis (fragmentation occurs) or if you can move data once it is placed in a container (optimization).
For a start, see if "Best Fit Decreasing" works in your case. It's pretty easy to implement, assuming I even have your problem defined correctly.
Robert C. Cartaino
|
|
|
|
|
Hi,
I'm trying to debug a deadlock problem, but I can't find anything that shows which thread owns a particular lock. Is there something that does this?
klk
madness ? this.isSparta = true : this.isSparta = false;
|
|
|
|