|
myventsi wrote: Sol1.Data.
what's with all the dots?
Windows uses a backslash as a path separator.
Visual Studio shows solution and project items in its solution pane, they reflect real files and folders.
myventsi wrote: RegFile = new FileInfo("Sol1.Data." + MyCombo.SelectedItem.ToString() + ".mdb");
Bad style. What if nothing was selected in the ComboBox?
Split the line in several lines, compute the filename first, so you can look at it, then call FileInfo.
For the filename, safest approach may be to use an absolute path, something like:
object item=MyCombo.SelectedItem;
if (item!=null) {
string filename=@"C:\myfolder\myproject\Sol1\data\"+item.ToString()+".mdb";
RegFile=...
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
|
Not sure what it is you want, here are some facts:
- you can only read/write files in existing folders;
- you can create folders using Directory.CreateDirectory (there is no need to test existence first).
- some folders may be "write protected" or "access denied" (more so on Vista).
- there are some "preferred locations" for data files belonging to an app, for data files for a particular user, etc. Have a look at Environment.GetFolderPath(). Don't be surprised if the result depends on the Windows version ("Documents and Settings" on XP became "Users" on Vista).
I tend to use Environment.SpecialFolder.ApplicationData quite a lot.
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
|
However you created it, it still is a regular folder, it lives on your disk, and technically it has no relationship with your project or solution.
And it will not exist on another machine.
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Directory.Create() creates a new folder in the given path as param. Application.StartupPath will give you the directory path of the current application. Application.ExecutablePath will give you the current application path.
hope these may help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Example : when i click a button then Show "Emploee Info.aspx" webpage and input data to the server
|
|
|
|
|
Use the Process class i.e.
System.Diagnostics.Process.Start("http://www.microsoft.com"); Previous discussion using a LinkLabel here[^].
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)
|
|
|
|
|
hi,
i am using treelistview in my project,
TreeListView
I am unable to find a way to edit specific column on key press.
like
Pressing F2 enters edit mode or i will call beginEdit event.
i am calling beginEdit event and passing required paramiters, but it is not working.
plaese let me know how will i achinve this.
my email id is hirenkshah@gamil.com.
Thanks,
Hiren Shah.
Thanks
hiren shah
|
|
|
|
|
|
hai all, i got below type data from sql server through "Select" Query in the form of rows.
X 100
Y 100
Z 100
X 100
Y 100
Z 100
X 100
Y 100
Z 100
i have to retreive the data in this below format:
X Y Z
100 100 100
100 100 100
100 100 100
100 100 100
100 100 100
Thanks&Regards,
Sekhar.
|
|
|
|
|
What if there's different numbers for the same letter, or not the same number of items for each letter ?
It's hard to know based on this question exactly what you want, or how best to display it. You need to provide more details. It's ultimately a SQL question, and we have SQL forums. A grid view will display your data exactly as it comes from the DB, the issue is not the gridview.
'
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Is there a way to create application settings at runtime? So that I can save the locations of each controls on the form.
Thanks in advance.
|
|
|
|
|
I'm not sure if you can. What you can do however is create a setting as a List<T> where T is a built in type or a class/struct of your own and add and remove to/from that list.
See my article here[^] for examples.
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)
|
|
|
|
|
Take a look at this[^].
Following the instructions will enable you to save locations, sizes etc. for any control.
Sokka93 wrote: Is there a way to create application settings at runtime
AFAIK there is no easy way to do this at run-time. However if you follow the link above, it will allow you to do the same thing.
Good luck!
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.”
|
|
|
|
|
What you could do is create a new registry key
Name the new key "Your program settings".
RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software,true);
ProgSettings.CreateSubKey("Your Program settings");
ProgSettings.Close();
Now you can add Sring Identifiers and values.
RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software\\Your Program settings",true)
ProgSettings.SetValue("Setting Name",value) //store settings
string settings = ProgSettings.GetValue("Setting Name",false);// retreave settings
ProgSettings.DeleteValue("Setting Name",Setting Value);
Besure to close the registry key when you are done to avoid conflicts with other parts of your program that may write to the registry.
Many comercial software applications use these methods.
Code Project has many examples about Writing and reading to the registry.
This is much easyer the modifying the appconfig.xml file that is used when you create settings.
Hope this helps
GOD bless
Regards
|
|
|
|
|
What you could do is create a new registry key
Name the new key "Your program settings".
RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software,true);
ProgSettings.CreateSubKey("Your Program settings");
ProgSettings.Close();
Now you can add Sring Identifiers and values.
RegistryKey ProgSettings = Registry.CurrentUser.OpenSubKey("Software\\Your Program settings",true)
ProgSettings.SetValue("Setting Name",value) //store settings
string settings = ProgSettings.GetValue("Setting Name",false);// retreave settings
ProgSettings.DeleteValue("Setting Name",Setting Value);
Besure to close the registry key when you are done to avoid conflicts with other parts of your program that may write to the registry.
Many comercial software applications use these methods.
Code Project has many examples about Writing and reading to the registry.
This is much easyer the modifying the appconfig.xml file that is used when you create settings.
Hope this helps
GOD bless
Regards
|
|
|
|
|
|
HI All,
I am using RDLC (SQL server reports) for creating reports. When i try to import report into PDF the Hindi fonts are not shown instead the ? is shown . Can someone tell what's the solution.
Thanks,
kanwal.
|
|
|
|
|
SqlCeCommand cmd = new SqlCeCommand("select count(*) from diet where uname=@uname,day=@dy,month=@mnth,year=@yr", conn);
cmd.Connection = conn;
SqlCeParameter para = new SqlCeParameter();
para.ParameterName = "@uname"
para.Value = uname;
cmd.Parameters.Add(para);
SqlCeParameter para12 = new SqlCeParameter();
para12.ParameterName = "@dy"
para12.Value = dy1;
cmd.Parameters.Add(para12);
SqlCeParameter para13 = new SqlCeParameter();
para13.ParameterName = "@mnth";
para13.Value = mnth;
cmd.Parameters.Add(para13);
SqlCeParameter para4 = new SqlCeParameter();
para4.ParameterName = "@yr";
para4.Value = yer1;
cmd.Parameters.Add(para4);
count = System.Convert.ToInt32(cmd.ExecuteScalar().ToString());
I have tried this code but getting an exception- An error parsing the query.
How to pass multiple parameters to the query which counts the rows from a table?
Please help.
Thanks in advance.
|
|
|
|
|
What database are you using?
select count(*) from diet where uname=@uname,day=@dy,month=@mnth,year=@yr
try instead;
select count(*) from diet where uname=@uname AND day=@dy AND month=@mnth AND year=@yr If your where -clause is built from multiple filters, use the AND keyword to concatenate them.
I are troll
|
|
|
|
|
Hi, I am targeting .NET 3.5 and developing using Visual Studio 2008 Team System. I have a custom task that runs at the "Commit" phase of the installation. To carry out the required works in that task, I need to know the location the user chose to install the application. Is there any way to access it in the task? I tried "Assembly.GetExecutingAssembly().Location" but that returns the windows directory, not the directory the application is being installed.
I have found that in the "File System" section of the installer project, properties of the "Application Folder" includes a property named "Property" that has its value set as "TARGETDIR". Does that provide some way to get the installation location?
Edit: One more info, the custom action is a standard windows form project, it does not contain any installer class or anything. Just contains a windows form and two user controls. The project type is "Windows Application" so it creates an exe. Just thought these info might be needed.
modified on Saturday, April 4, 2009 1:09 AM
|
|
|
|
|
I have found my solution after much searching. For anyone else in the same situation, here's what I did.
In the properties of the custom action that is created, there are two properties, "Arguments" and "CustomActionData". If your custom action is an exe or dll, use the Arguments property and write the value as
"[TARGETDIR]
That double quote(") at the start is required so that you can get the full location in a single string instead of the back spaces being treated as separators and get the location split across the array.
Now you can simply get the installation location through the argument array on your program.
Point to note: if you create a windows form project, the Main method does not contain the argument array as parameter. You need to add it yourself as
static void Main(string[] args)
and then you can get the location as args[0] .
In case your project is another installer class, then you need to pass the data through the CustomActionData property. There are a lot of resources out there if you are using an installer class on how to provide value, what should be the format for the CustomActionData and so on. Here's an walkthrough in MSDN:
http://msdn.microsoft.com/en-us/library/9cdb5eda(VS.71).aspx[^]
|
|
|
|
|
hi
i have following query which works in sqlserver 2005 but same query shows the error in my sql is there any other syntax plz help
i working on pivote table and qury run in sql2005 but not in mysql why?
create view myview as
select * from dbo.master1
pivot
(
count(EmpName)
for EmpSubGrp in
(EG3 ,TM5 ,TMA ,TMC ,TM1 ,TM2 ,OP6 ,OP7 ,TMB )
) as p
|
|
|
|
|
Because standard SQL is not enough, and every DB has it's own extensions. This is a SQL question, we have a SQL forum.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|