|
I have built a windows form using C#( .NET 2.0 ). The form has a label with text set to “:My label text.” When I build and run the form here everything looks fine.
When a person is running the form in UK he sees the label text as “.My label text:”
I am not able to figure out the reason for the colon to be moved to the end and the fullstop to be moved to the front.
I don’t think the UK locale would be causing this.
Have seen this happening?
Thanks,
Sudhir
|
|
|
|
|
Isn't by any chance the colon and fullstop entered with right-to-left text mode?
|
|
|
|
|
Not only that you should also think about internationalization. In the UK the date and time format is different and they are also using a different codepage (English/US vs English/UK).
|
|
|
|
|
hello techs,
I have a small project which enables database backups.
I have to to do backup's for multiple database @ a time.
For that i need to use Threading concepts.
the below code is for database backup :
-----------------------------------------------------------------------------------------------------
public void backUpDatabase(string DBname, string setBakUpPath)
{
SqlCommand sCom = new SqlCommand("BACKUP DATABASE " + DBname + " TO DISK = '" + setBakUpPath + "' WITH NOFORMAT, NOINIT, NAME = 'Full Database1 Backup', SKIP, NOREWIND, NOUNLOAD,STATS = 10", sCon);
sCom.CommandType = CommandType.Text;
try
{
sCom.ExecuteNonQuery();
MessageBox.Show("Database " + DBname + " : BackUp Done!", DBname + " BackUp", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString(), "Backup ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
sCom.Dispose();
}
-----------------------------------------------------------------------------------------------------
all the databases will be loaded to a list box and i will select a database and clicks on button "Backup Database" and it will starts backup.... I need to do the backup in a thread. Now on the datagrid ... it will show the "db name", "Status : backup going on/backup done" and finally % of percentage of backup in the third colum of grid (u can avoid if this a bit time consuming... )
Please help me to solve it, if any clarifications needed... please ask ... thanks ...
A123-B321
|
|
|
|
|
jikubhai wrote: and finally % of percentage of backup in the third colum of grid
That's a good one considering you are making a blocking call to perform the backup
jikubhai wrote: sCom.ExecuteNonQuery();
|
|
|
|
|
|
What you don't know what "blocking call" means? You might need to study some fundamentals before you develop production applications.... just a thought.
|
|
|
|
|
Hello,
Hope someone can help with this, I've built a collection which I'm then using to populate a ListView. I need to somehow be able to sort the ListView by 2 columns, column indexes 3 then 2. The ListView contains information about advertisements in a publication and I need to be able to sort by section (column 4, idx 3) then page no (column 3, idx 2). The thing is, how?
I know I need to use the ListViewItemSorter method somehow but I've no idea how to attach the required columns. It will only ever be these 2 columns and they will always have the same position in the ListView (idxs 3 & 2).
Hope someone has a work around for this, I've managed to do it in a DataTable but can not get it working here yet. If anyone has a different solution to this problem, please don't be shy. I'm more than open to new ideas.
Thanks in advance everyone,
Scott
|
|
|
|
|
|
Hi,
same as for any other collection you want to sort (array, ArrayList, ...):
write a class that implements IComparer and pass that to the Sort() method; on a LV that
happens through setting ListViewItemSorter property.
Implementing IComparer means providing a single method that takes two objects and returns an int:
int Compare (
Object x,
Object y
)
the int value should be negative, zero or positive depending on the sort order of the
two objects;
you would have to cast these objects to whatever type it is you have in the ListView.Items collection
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi!
I think one important point that might not be entirely obvious is that you sort by one column first and only have to return the result of the second column's comparison if the items to compare are the same in the first column!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I need to safely open a text file and send its contents to a textbox, if it doesnt exist i need to create it and then open it and show nothing in the textbox. I keep getting a "file is in use by another process" error.. here's my code..
TextReader fstream;
fp = filepath;
try
{
fstream = new StreamReader(fp);
}
catch (System.IO.FileNotFoundException)
{
File.CreateText(fp);
fstream = new StreamReader(fp);
}
bool done = false;
while(!done)
{
Alert = fstream.ReadLine();
if(Alert = null)
{
done = true;
else
{
textBox1.AppendText(Alert + "\r\n");
}
}
fstream.Close();
|
|
|
|
|
Dio22 wrote: I keep getting a "file is in use by another process" error
If another process has the file open in non "share" mode you will not be able to open it. Perhaps you have it open in some editor or something?
|
|
|
|
|
nope, nothing has it. error only happens when the file doesnt already exist. *shrug*
|
|
|
|
|
Dio22 wrote: error only happens when the file doesnt already exist. *shrug*
Yes that is because you are trying to create it in the catch() while you still have the active StreamReader in the try{} block.
|
|
|
|
|
Hi all,
Please could someone help me !!!!
I have a static class that I wish to use to create event handlers on controls.
I know the name of the class and method, I then want to create an instance of that class and assign one of its methods to be the event handler of the control. Bellow is roughly what I want to do (but it isn’t working )
object obj = Activator.CreateInstance("project1", vItem.Value.ToString());
pCtrl.TextChanged += new EventHandler(obj.GetType().GetMethod("MethodForEvent"));
The obj is wrapped instance and the getMethod returns null
Any Ideas ?
John
|
|
|
|
|
john34 wrote: Any Ideas ?
What are you trying to do? Is this some sort of plug-in solution?
|
|
|
|
|
Is there any significance to the use of the @ in a variable name (like @intx)?
Thanks.
|
|
|
|
|
The @ symbol is usually used for SQL Server parameters
SqlCommand.Parameters["@ID"].Value = 1234;<br />
<br />
CREATE PROC sp_MyProc @ID INT <br />
AS<br />
SELECT * FROM Table WHERE ID = @ID
The at symbol is also used to escape string literals
string path = @"C:\Program Files\Some Folder";
only two letters away from being an asset
|
|
|
|
|
sa_runner wrote: Is there any significance to the use of the @ in a variable name (like @intx)?
Using @ means that you can have a variable name that (sort of) matches a type name, e.g. object @object. In your code you can then refer to @object. It really doesn't seem to be good practice to me.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
In SQL yes, in C# no.
You can use it in c# as well, but the only thing that happens is that Intellisense does not work on this variable
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
@ is used to specify an identifier. It's mostly used to access members of third party classes that happen to be keywords in C#.
Example:
SomeComponent.@int x = new SomeComponent.@int();
---
single minded; short sighted; long gone;
|
|
|
|
|
Interesting, learn something all the time. Can't say as I've every seen this in use, and can't think of a reason why.
only two letters away from being an asset
|
|
|
|
|
reserved words are different in different languages. It's needed to allow assemblies written in Foo.net to always work in Bar.net without requiring any changes to the Foo.net source code because the author used a variable name that's reserved in Bar.net. MS tries to avoid any situation like this for the languages they officially provide (I've never actually seen it used myself), but the more languages supported the harder it becomes, and 3rd parties don't always have the same degree of foresight into cross language issues. This is an officially sanctioned work around.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
That explains it, thanks.
only two letters away from being an asset
|
|
|
|