|
Hi,
How to retrieve records from Excel Sheet..Its working fine when i have a column name in the Excel sheet, if suppose i didnt have the column name. i have to retrive record in the basis of column index..how can i acheive this one.. im using C#.net 2003..
Regards
Kanna
|
|
|
|
|
Hello!
I´ve got this regular expression:
Regex.Replace(amount.Value.ToString(), @"(?<=^-?\d+)(?=\d{3}$)", ".")
it takes a value and returns it formated like this:
1 -> 1<br />
12 -> 12<br />
123 -> 123<br />
1234 -> 1.234<br />
12345 -> 12.345<br />
123456 -> 123.456
problem arises when number of digits are above 6, the code then returns
1234567 -> 1234.567
whereas I would want it to return
1234567 -> 1.234.567 and 12.345.678, 123.456.789 etc.
I realize the '$' character´s got go , since it means end of string, but if I remove it I get really strange results.
Could someone help me alter the expression to achive this?
modified on Monday, April 14, 2008 5:23 AM
|
|
|
|
|
An easier way to do this would be to just do it using string mashing. Or using string.Format to do decimal formatting for you.
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 )
|
|
|
|
|
Solved it with System.Globalization.NumberFormatInfo, thanks!
|
|
|
|
|
Hi,
I want to load bigger size file into GUI (typically Text box),but it takes lot of time in the intial loading to avoid this like to load part of data and rest during scroll bar moving. For this i'm prefering to go for Lazy Loading.
Does anyone has solution example for lazy loading to meet his requirement? Is so give me link to walk through
Thanks
|
|
|
|
|
Sounds like you read a technical term while on the toilet and now you're hoping it will magically solve your problem. Lazy initialisation is not going to speed anything up, it just defers when something is loaded. IF a textbox takes a long time to load, one has to wonder why you're putting such a huge file in a textbox to start with.
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 )
|
|
|
|
|
Hallo,
I am working on application that provide multilanguage support. I am working with resource files. I have completed most of the part text, buttons, labels and messagebox text too. Now I want messagebox buttons YesNo to provide multilanguage support. In buttons, i have used buttons.text, but this is not working with messageBox buttons. I will be thankful if anyone could help in this regard.
Thanks in advance .
|
|
|
|
|
cooltoad123 wrote: Now I want messagebox buttons YesNo to provide multilanguage support
AFAIK, this won't change. You need to write your own message box with required buttons.
|
|
|
|
|
Navaneeth is right, the language used comes from the locale settings for the PC.
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 )
|
|
|
|
|
|
Hi,
I have to export data from a given select in a database from one server to a table from another server.If the table where i have to insert data doesn't exist, i have to create it.Since i can't use select into which also creates the table(servers are not linked so select into won't work), i have to generate script manually and i'm using the column types from the DataTable filled using a SQlAdapter to do this.My problem is how do i map System.Type in the CREATE script.I tried using DBType, but that also returns strings like Int32, which i can't use.If let's say, i change Int32 to int will work, but doing this for every Type would mean a lot of work.
Any ideas on how to do the mapping, or is there a different approach to do this?
I could use select..into..where 1=0 on the source database to create an empty temporary table, use SMO to obtain the script and delete the temporary table, but i think it has risks so i'm trying to avoid it.
Thank you
modified on Monday, April 14, 2008 7:08 AM
|
|
|
|
|
hi..
How to read and close an image from a file.I used
Image img=Image.FromFile(val) code to read image from file....But once i read that one ...I wont be able to delete it or overwrite it bcz my my current project process is using that one...Also I used bmp.Save() method to write image into file.Is there anyway to overwrite a file using bmp.Save() method ?.It will be very helpful if explains with code..
modified on Monday, April 14, 2008 3:58 AM
|
|
|
|
|
Please don't make your post bold. It's jut annoying.
You need to copy the image, close the original, and save from the copy. This is a bug in .NET.
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 )
|
|
|
|
|
Denver Thomas wrote: Image img=Image.FromFile(val)
I think Image.FromFile() won't release the file handle immediately. You may try to read the files from a stream and dispose stream after image loaded. It would be something like
Image img = null;
using (FileStream fs = new FileStream("imagePath", FileMode.Open))
{
img = Image.FromStream(fs);
}
|
|
|
|
|
hi friends....
thanks for your reply.I tried both the methods..but failed.
When i tried reading from stream...it is showing out of memmory exception.
I tried another method like take a clone of the original bitmap and dispose that one...but still that process is not releasing that image. Is there any other way to do that ?
|
|
|
|
|
Denver Thomas wrote: it is showing out of memmory exception.
What is your image size ? Is it too big ?
|
|
|
|
|
yes yes....it is 600*624 in size...any other way to do that ?
|
|
|
|
|
Denver Thomas wrote: 600*624 in size
This don't make any problem. I was asking for the file size.
|
|
|
|
|
Hi,
Image class returns some weird exceptions, OutOfMemory typically means image format not
supported, or "The file does not have a valid image format" (i.e. some data error in file).
It is not indicating a memory problem!
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
choose one implementation, show us the code and give us exact symptoms. Then we can
help and figure out what is going wrong.
BTW: is the image file you want to delete a recent file, i.e. did your app create it
as well, or is it a pre-existing image file?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
oh thank u friend....i didnt tried "embeddedcolormanagement" parameter of fromstream Method.... I think it will work ...
|
|
|
|
|
I have a settings form for my application (ex: default start time for a task is 8:00 AM, or background color of the app). Where do you think it's better to store these info?
1. app config
2. setting table in database
3. registry
|
|
|
|
|
|
It depends on your app in some ways. If you store in a database your settings are dependant on accessing the database - if its unavailable what would the impact be. The registry is a bad idea, that went out with the ark. Too many registry entries slow the computer, which hive do you put them in, maintenance is a pain etc.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Yeah, it depends on how you want them to work.
If they are stored in a database, then the user can use his settings regardless of which computer he is at. (Some of my software is used in a call-center where a user may not get the same workstation each shift.)
They could also be stored in "C:\Documents and Settings\All Users\Application Data" so every user on the specific computer gets them.
Or in "C:\Documents and Settings\specific user\Application Data" so each user has his own set on that computer.
I don't use App.Config, but that's just me.
<Aside>
Won't the App.Config get overwritten during an update?
</Aside>
Oh, and the registry is evil.
|
|
|
|