|
I have a stupid question:
May I include a file of any type into my project for further using?
For example, I include a text file into my project (Readme.txt), then I can read this file internally from my project by my form
|
|
|
|
|
If you set it to be an embedded resource, it's included in your assembly.
You can then, for example, use
Assembly asm = Assembly.GetExecutingAssembly();
Stream str = asm.GetManifestResourceStream("MyNamespace.Readme.txt"); to get a Stream that you can read the embedded resource with.
One important fact is that you have to give the complete name of the embedded resource (including your assembly's namespace) or else it cannot be found and you'll receive null from GetManifestResourceStream() .
Regards,
mav
|
|
|
|
|
Hi
I don't know if it's possible to include any File to a project. But I dont't think so.
But if you want to read a text file you can use the StreamReader Class.
Example:
using System.IO;
string read ="";
StreamReader sr = new StreamReader("c:\\readme.txt");
sr.ReadLine();//or any method you need
read = sr.ReadLine().ToString();
sr.Close();
|
|
|
|
|
no, I mean this file is included in my project, not in hard ive
|
|
|
|
|
Hi...,
1:I want to fix printer and paper seeting in C#.
I want that when user click on Printpreview button than Paper size automatically fix on A4 and Margin left and right 0.3 and top and bottom margin 0.5.
Does any body now how to do this job.
2: In c#.net how i export sql database data in access database file as in Sql own feature.
|
|
|
|
|
Hello,
I load data from SQLServer Dynamically. Loading data is okay however i dont know
how i could change the Column Title for Each Column. Here is my Code with missing code
that could change the Column Title.
string server="server=FRITZ; integrated security=SSPI; initial catalog=IDDatabase";
string selectcmd="Select username,userdatecreated,usercreatedby FROM IDUSERS";
SqlConnection conn;
SqlDataAdapter da;
DataSet ds;
conn=new SqlConnection(server);
conn.Open();
da=new SqlDataAdapter(selectcmd,conn);
ds=new DataSet();
ds.Clear();
da.Fill(ds,"IDUSERS");
dataGrid1.DataSource=ds;
dataGrid1.DataMember="IDUSERS";
conn.Close();
Thanks
|
|
|
|
|
Hi,
You can change the column title using ColumnName property of DataColumn.
ds.Tables[0].Columns[0].ColumnName = "Employee Id";
ds.Tables[0].Columns[1].ColumnName = " Employee First Name";
Change the column names before associating the data set with the data grid.
Hope this will help you.
Regards
SGS
|
|
|
|
|
Hello,
You're code works as expected.
Thanks a lot.
Regards,
fjlv2005
|
|
|
|
|
Hai,
I want to place a button on my form to open command dialog box . i.e to open files..from dirves..they may me word docs anything.
say in c: i have few word docs.
i wnt to place a option to open them.
kindly give me the code for this.
chand
|
|
|
|
|
Hi
I think you need something like OpenFileDialog.
Try this:
OpenFileDialog openfile = new OpenFileDialog();
openfile.Show();
|
|
|
|
|
My application re-configures the network settings (IP, Subnet Mask, Gateway, DNS..) and after that I want to disable and then enable the Local area connection (not the network card), so the connection is refreshed with the new settings without having to restart the computer. Does anybody have any idea on how to do it in C#? Thanks for your time.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
You don't have to disable/enable to network card to get the settings to refresh. You can make the changes using WMI, but watch the return codes. No matter what method you chose to make those changes, Windows will tell you if the machine has to be restarted for the changes to take effect. Otherwise, in most cases, the changes you make take effect immediately.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a field in a database that contains a value with double quotes ("Test Value"). I am trying to use this in a javascript by writing it back out. I need to be able to seach the string for double quotes and replace them with \" so that the end result is \"Test Value\". Is there a function in .NET to handle this? In Delphi, there is a QuotedStr() function.
|
|
|
|
|
No - but it's easy enough to write your own.
David Anton
Tangible Software Solutions
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# Converter and the Instant VB C# to VB.NET Converter
|
|
|
|
|
What is the best way to check for the double quote in the returned value?
|
|
|
|
|
Nevermind. I have resolved the issue with Replace("\\"", "\\\"")
|
|
|
|
|
I create a bitmap in this way:
bitmap myBmp = new Bitmap(100,100);
now i want to color all the bitmap of green, how?
|
|
|
|
|
|
Hi people,
I have a user control that draws a Bezier (drawing occurs in OnPaint and OnPaintBackground). This control is used in a windows form. Is there a way to get the graphics of that control to be able to save it in a file?
thanks,
Talal
"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
|
|
|
|
|
hi again,
well I managed to send back the Bitmap to the main form, but I had to recreate it in the returning function. I was wondering if there is a way to get back what I had already drawn in the control.
thanks,
Talal
"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
|
|
|
|
|
hi there
i'm trying to extract certain information from an HTML source, i've used the : WebClient from the .NET library to Screen Scrspe the web page the second part is to use RegEx to EXTRACT usefull information to me from the HTML source available and because i'm not very familiar with regular expressions i need help to do this for example:
I NEED TO EXTRACT THISand then to place whatever is extracted within XML tag (i.e. converting)
thanks and regards
jay
|
|
|
|
|
<td class="subhead" colspan="2">(?<content>.*?)</td>
where group "content" will contain text "I NEED TO EXTRACT THIS"
or more generaly,
<td(.*?)>(?<content>.*?)</td>
RETester[^] is nice place for testing... Check out Reg Ex Lib, too.
best regards,
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
thanx alot, appreciated
|
|
|
|
|
ok how to do without the tags,,i.e just the : (?<content>.*?)
regards
|
|
|
|
|
I don't understand your question... Read MSDN here[^]
ah maybe I know what you mean... try @"yourregexhere". You know what I mean?
hope it helps
David
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|