|
hi,
plz i created a connection string in a class
what else should i do in the form where i need the connection to be opened.
connection string in my app. is "conString" .
Regards
|
|
|
|
|
I think you need to read book about ADO.NET
If you have connection string you can use one of the overload of sqlconnection class to create new connection.
|
|
|
|
|
i would google for 'c# database connect connection string' or something similar
|
|
|
|
|
hi ,
i am using VS.Net 2005 AND I Want to use ResourceManager to read from my resource file .
i was add 1 resource file with vs.net and .net create resource file in Properties folder (Properties/resource.Resx) .
i am trying to create resource manager with following code
ResourceManager rm = new ResourceManager("resource",Assembly.GetExecutingAssembly());
Error ocurred in RunTime in instasiate statment .
what is the proble ?
tnx 4 ur help............
---------------------
Areff Bahrami(KAVEH)
Areff.HB@Gmail.com
---------------------
|
|
|
|
|
What was the error message?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
With .NET 2.0, there is an easier way to do things.
First of all, you need to create the local resources folder called App_LocalResources or the global resources folder, App_GlobalResources . Files located in the local resources folder will have to be named like their corresponding ASPX files; files in the global resources folder can be named whatever you like.
Now, suppose you have a file called myPage.aspx . If you decide to use the local resouces, it means that you will create resource files only for that page. Your resource files should be named: myPage.aspx.resx (this one should always be present), then for different languages you would have: for US English: myPage.aspx.en-US.resx , for Switzerland French: myPage.aspx.fr-CH.resx , etc....
For the global resources, you can use any file name you like to replace myFile.aspx .
Now to access the resouces:
Assuming you have a label lblFirstname to which you would like to assign the value of the resource called "firstname " in the resource files, you would write:
For local resource: lblFirstname.Text = GetLocalResourceObject("firstname").ToString();
For global resource: lblFirstname.Text = GetGlobalResourceObject("GlobalFile", "firstname").ToString();
where GlobalFile will be the name of the global resource file.
I hope this helps
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
tanks for your help but i want to know why error ocured in this code and how can i fix this problem ?
ResourceManager rm = new ResourceManager("resource", Assembly.GetExecutingAssembly()):
there was this resource file :
Properties/resource.resx
tnx
---------------------
Areff Bahrami(KAVEH)
Areff.HB@Gmail.com
---------------------
|
|
|
|
|
I think I remember that when I was working on a project in .NET 1.1 I got some problems with the GetExecutingAssembly() . I don't remember exactly why it wasn't working but I used another piece of code to solve the problem. Also, I think you should put the whole name of the resource file (with namespace reference).
If you have a file called resource.resx in a folder "Properties " of project "myProject ", you should put the file as "myProject.Properties.resource ".
The code I use is this:
ResourceManager rm = new ResourceManager("myProject.Properties.resource", Type.GetType("namespaceName.pageClassName").Assembly);
where pageClassName is the name of the page class where your code is located and namespaceName is the namespace where this class is located.
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
we can use lock/Moniter to synchronize the instance method/variable , but how to synchronize static method/variable?
|
|
|
|
|
lock on a static variable !
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
My screen contains a DataGrid(System.Windows.Forms)control, in Save button click i am inserting the data present in the grid. I have given Alt+S as shortcut key for my Save button, ext present in the DataGridTextBoxColumn is not getting inserted while i use Alt+S, but inserting when i click Save through Mouse, it is due to Uncommitted data to TextBoxColumn, any body help me in solving this problem.
srikanth
|
|
|
|
|
hi all,
I've figured out how to set DataGridView columns to wrap text if the
text doesn't fit in the alloted column width.
This is great, but the row height isn't enough to display the wrapped
text. Is there a way to set the height so that all wrapped text in the
cell is displayed?
Thanks in advance.
Regards
Anuradha
|
|
|
|
|
Anu,
The first two soulution given in the following link might solve your problem, I have not tried them.
Autosize rows in datagrid[^]
|
|
|
|
|
hi sathish,
thanks for those links. i tried it. the second link worked for me than the first one.
Thanks once again
Regards
Anuradha
|
|
|
|
|
hi
my application is written in C# .net 2003 compact framework for desktop and CE device.
i am unable to control the tab order. is there any way to do it. rearranging the controls is not a solution for me. is there anyother way.
thanks.
|
|
|
|
|
Hi, TabIndex property is supported since .NET CF 2.0 (i.e. VS 2005).
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I know with regular windows forms you can set the tab order by going to view on the menu bar and then click tab order. It will number all the controls and you can renumber them. I don't know if that same feature works with the compact framework. I would think it would.
Ben
|
|
|
|
|
Hi, does anyone know where i can get coding or just info on the classes and methods of the Tamir library?? I recently acquired it and cannot utilize it until i know exactly whats going on with it. My other question is does anyone know how to set up and send files over a sftp protocol with linux and windows (in C#) in a similar fassion.
P.S Iv never worked with sftp or ftp on a coding level so any assistance you could give me would be greatly appreciated.
George Berry
|
|
|
|
|
What does this component do? Where did you get it? Without this information, there's not a lot I can do.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I just found it is part of an example on sourceforge. But its not as important as finding out how the sftp works, necessary lib's and especially lin/win compatability. So regardless of this lib file that someone created, how do i sftp??
George Berry
|
|
|
|
|
Will this[^] article help?
/ravi
|
|
|
|
|
Thanks, now all i have to to is finish the serial port prog im working on, decypher whats going on in that example, and im all set.
George Berry
|
|
|
|
|
Hi I am developing a windows application (VS 2003) in which it contains some buttins and a grid. The Grid has to show all the data from a csv file, for this i am reading all the data from csv file into datatable and giving that datatable as a datasource to data grid.
dtTable = new DataTable();
dtTable.Columns.Add("Name");
dtTable.Columns.Add("Time1");
dtTable.Columns.Add("Time2");
dtTable.Columns.Add("Path");
dtTable.Columns.Add("IconName");
dtTable.AcceptChanges();
if(File.Exists(Application.StartupPath + "\\Recordings.csv"))
{
StreamReader sreader = new StreamReader(Application.StartupPath + "\\File.csv");
string strval = sreader.ReadLine();
while (strval != null)
{
DataRow row1 = dtTable.NewRow();
string[] str = strval.Split(',');
for(int i = 0; i < str.Length; i++)
{
row1[i] = str[i];
}
dtTable.Rows.Add(row1);
strval = sreader.ReadLine();
}
dtTable.AcceptChanges();
sreader.Close();
// }
dtGrid.DataSource = dtTable;
dtGrid.Refresh();
I am using the above code for showing the contents of file to Grid.
if user clicks start button on the form, after completing the action i want to add a row to grid. For this i am writing the new row to the CSV file and calling the above code.
But it is giving error: "Controls created on one thread cannot be parented to a control on a different thread."
Any one please help me.
Thanks in Advance
|
|
|
|
|
You need to always deal with your controls in your main thread.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
use an event to trigger the creation of your control on the main thread, or use this.InvokeRequired to force you control to be created on the main thread
|
|
|
|