|
Hi
i want to view a .ini file through c#. can anybody help me to write code for it? i mean i just want to know how to open a .ini file to show it to user.
Regards
sAqIb
|
|
|
|
|
Hi,
There is one programme in codeproject which changes the folder icon,which acctually changes the desktop.ini file ,go through that programme just search in codeproject about it like "changing folder icon".you wil get your answer .enjoy man.
|
|
|
|
|
hi
i don't know if i understand you question, but you can read its content like this:
StreamReader Reader = new StreamReader("a.ini");
String strContent = Reader.ReadToEnd();
Tamimi - Code
|
|
|
|
|
|
thanx everybody.
i got to know how to do that. we can view ini file or any other file like
System.Diagnostics.Process.Start("filename.extension");
hope it will help to other guys here too.
Regards
sAqIb
|
|
|
|
|
I am trying to reverse engineer my application to see the class diagram in visio. The reverse engineering succeeded but the visio file is empty. no diagrams in it.
Can anybody give me some helpful hints on that?
Naji
|
|
|
|
|
It may have created a visio model even though there are no diagrams. Check the model explorer window. You can create your diagrams yourseld by dragging the objects into a page.
--------------------------------------------------
|
|
|
|
|
Dear all,
I have add a listbox with following property on
listbox1.DrawMode=OwnerDrawVariable;
listbox1.HorizontalScrollbar=true;
listbox1.ScrollAlwaysVisible=true;
I am overriding the DrawItem event of the ListBox for drawing item's text. Some text are too big to fit in the list box. But the Horizontal Scrollbar is not enabled or working. Horizontal scrollbar is visible and [disable or dim]. Vertical scrollbar is working fine.
Please help.
|
|
|
|
|
when we have a project of c# consisting of many subprojects.....
subproject B is dependent on subproject A
if we build the subproject A and then build subproject B the subproject A is not again built............whereas if we build subproject B first then subproject A is also built
how c# compiler manages this.......where this information is stored that subproject A has already been built
|
|
|
|
|
Hi,
From what you said i understand that you have several projects in the same solution. To build the entire solution with all the project you can use the Build->Rebuild Solution option. If you want to build all the projects from your solution when you hit the build shortcut key try entering in the Configuration Manager and see if all project are checked for building.
Do your best to be the best
|
|
|
|
|
thanks sir but my question is
while building project that has subprojects the compiler keeps record of the subprojects that have been built it does not rebuild them...........i want to know where this information is actually stored.if a subproject is built and then we built another subproject that is dependent on it the compiler didnt rebuild the previous one it means that the compiler keeps some record of it i want to know where this record is maintained................which file the compiler uses to maintain this info.......to make it clear what i want to say consider
three subprojects A,B,C in a project........B & C are dependent on A..........from the right panel where all subprojects and files are listed we right click project B and build it.......in the progress bar we will see two build succeded......A is also built as B is dependent on it......then when we build C in the same manner this time only C is built not A .......it means the compiler keeps track of this.........i want to know where this information is stored.......
|
|
|
|
|
Hello,
when I bind a DataSource on the DataGridView and the count from the rows are not the high from the DataGridView, than you see the grey background from the DataGridView. See here, what i mean: DataGridView.
I use too the Software MS Money. In the sheet you see, that the rest is fill up with empty rows until the bottom border: MS Money. Now i thinking how i can do this with the DataGridView. When i have the DataGridView binding, than i cant added empty rows to the DataGridView. First i have thinking i added empty rows to the DataTable, but when i want update the DataTable than i must first checking, what is a fill up empty row and what not. Gives a easier way?
Perhaps can show me here a person the way what i should do. I dont have a plan
Greetings Oliver
|
|
|
|
|
I have created my project but now i want to create setup.exe file for that,can anyone help me about that.
nishu
|
|
|
|
|
File -> New Project -> Setup and Deployment -> Setup Wizard or (Setup Project)
Ut
|
|
|
|
|
I have been struggling with this for a while now and thought it was time to post it to the forum. I have a class library with nested collections. Each collection can contain an employee collection. The employee objects in each nested collection's employees collection can have different properties and different values. My problem is some of the properties will always be the same like FirstName, LastName, etc. Therefore I know that I need to have a main employee collection that all the other employee objects reference so that when I change the firstname all the employee's collections that contain that employee will update the firstname. How do I add an employee collection to each nested collection that references a main employee collection's employee, but I can change some employee properties in each nested collection that are unique to that class. I hope this was not too confusing. Below is a simple example of what I have done and it works correctly so far except for it creates a new object for the same employee for each employee collection.
Entities
|-Entity
..|-Employees.Employee
..|-Divisions
....|-Division
......|-Employees.Employee
......|-Groups
........|-Group
........|-Employees.Employee
Employee
|-FirstName
|-LastName
|-SomeProperty (Could be unique for each nested collection)
Any help would be appreciated.
-Garrett
|
|
|
|
|
Probably the most logical way would be to have an Employee class and than inherit from it specific Employee types.
|
|
|
|
|
Hi,
I currently have done a few small personal projects in C++ so I'm "ok" with the basics.
I was hoping somebody could a good learning C# book or two that you've personally read and thought were good that'll teach you basics up to advanced (sure I realize a book doesn't teach everything).
...If not a book, any decent resources to start learning C#, apart from the articles here, and MSDN.
Thanks .
PS. Sorry for my English, not a first language
|
|
|
|
|
Hi,
I read "Programming C#" By Jesse Liberty and i thought that it is quite interesting for learning C# for scratch to a,let's say, medium level. Try it.
Do your best to be the best
|
|
|
|
|
Im writing an application that will use the HTTPSocket class in SystemNet. I have checked the msdn documentation regarding thread safety which infact is safe to deploy the class in a thread however im unable to reach a code point of execution where data is supposed to be displayed. Better yet let me copy paste some simple code for everyone to see. The results are dubious.
class MyThreadPool
{
private static int i;
private string web_response;
private string company;
private long thread_id;
public MyThreadPool() { }
public MyThreadPool(string business_string, long id)
{
this.company = business_string;
this.thread_id = id;
ThreadPool.QueueUserWorkItem(new WaitCallback(HackCorps), new AutoResetEvent(true));
}
public void HackCorps(Object state)
{
string[] business = null;
business = this.company.Split('^');
Stream business_stream = WebRequest.Create(business[0]).GetResponse().GetResponseStream();
StreamReader business_reader = new StreamReader(business_stream);
Console.WriteLine(++i);
}
}
and the main
int main(){
string line = null;
long i = 0;
StreamReader read_business = new StreamReader("f://directory.txt");
while ((line = read_business.ReadLine()) != null)
{
MyThreadPool pool = new MyThreadPool(line, ++i);
}return 0;<----Code get here since all thread classes are created although they aren't processed will cause the probram to terminate. Is there some sort of lock to prevent this?
}
Thanks for your help...
|
|
|
|
|
Hey Everyone,
I have a windows application written in C#. Within this application I have several forms, all of which are derived from a single base form. Now, if I put a text box control on one of these derived forms and then show this form while running the application by using form.Show(), the standard built-in Copy and Paste functions only work when accessed through the control's context menu. Using the keyboard shortcuts will not work.
However, if I show the form using form.ShowDialog() then the keyboard shortcuts work again. Also, if I don't use the base form then the keyboard shortcuts work as well.
I've tried reproducing this using a very basic base form and derived form, nothing but two textboxes on either of them, and it works as would be expected. So obviously there must be something in my base form that is causing this but there's a lot of code in there to dig through and it seems like such an odd issue. So I was wondering if anyone has ever experienced this in the past or might be able to suggest what might be causing this.
TIA,
Brian
|
|
|
|
|
How can I cast an inherithed generic class?
class c1{}
class c2 : c1{}
interface I1<t>{ void meth(T t);}
class g1<t> : I1<t> where T : c1{}
class g2<t> : g1<t> where T : c2{}
static main(....)
{
I1<c1> oI1 = null;
g2<c2> og2 = new g2<c2>();
oI1 = (I1<c1>) og2;
********************* I get this error :
Unable to cast object of type 'g2`1[c2]' to type 'I1`1[c1]'.
*********************
Why? If c2 is inherited from c1 and g2 is inherited from g1 and I1, this should not work?
Thanks
|
|
|
|
|
Hello
Well, your code compiled well with me after some modifications. Here it is:
class c1{}
class c2 : c1{}
interface I1{ }
class g1<t> : I1 where t: c1{}
class g2<t> : g1<c1> where t: c2{}
I1 oI1 = null;
g2<c2> og2 = new g2<c2>();
public void MyMethod()
{
oI1 = (I1)og2;
}
You must have made another mistake somewhere!!
Regards
|
|
|
|
|
Thanks for your quick answer.
You're right, I made a mistake. I didn't write enough detail and it was confusing. I'm sorry.
Here's all my example :
class c1{}
class c2 : c1{}
interface I1<t> {void Add(t a);}
class g1<t> : I1<t> where t : c1{
public virtual void Add(t a){...}}
class g2<t> : g1<c1> where t : c2 { }
I1<c1> oI1 = null;
g2<c2> og2 = new g2<c2>();
oI1 = (I1<c1>)og2;
*******At this point, everything is good****
However if I do : og2.Add(...) my parameter can be type c1!!! And I don't want because in my g2 class, the object used must be of type c1.
If a change this line
class g2<t> : g1<c1> where t : c2 { }' for
class g2<t> : g1<c2> where t : c2 { }', everyghing is good at the compile and I have to pass a class c2 in the Add method. A class c1 is not allowed and that's good. Unfortunately, casting doesn't work.
Thanks again
|
|
|
|
|
Hello
daveroberge wrote: it was confusing
Was??! H$#l I'm lost in all those Gs an Cs?!!
Anyway, we will work this out bit by bit.
daveroberge wrote: if I do : og2.Add(...) my parameter can be type c1!!! And I don't want
C2 is inherited from C1!! So C1 could fit in the place of C2 sometimes.
Now I don't get three things:
1- You want to cast what to what?
2- Where is the call that makes the error?
3- One time you say your parameter can be C1 then you say C1 is not allowed. I'm totally lost!!
Please repost your code with the error -don't modify your cast-, and comment on the line with the error. The most important thing is to check the "Ignore HTML tags..." below the post editting textbox so that the generic code tags would appear in your code.
PS. If I didn't reply for a while that means I fell asleep:->. Then I'll first thing in the morning!! It's 12:26AM here in Cairo and I should have been in bed about an hour ago!!
Regards
|
|
|
|
|
Hope your night was good
this is a better code :
interface I1<t> { void Add(t a); }
class c1{
public string sVal = "test";}
class c2 : c1{
public string sVal2 = "test2";}
class g1<t> : I1<t> where t : c1{
public virtual void Add(t a){a.sVal = "svalmodified";}}
class g2<t> : g1<c2> where t : c2 {
public override void Add(c2 a){
a.sVal2 = "testmodified2";
base.Add(a);}}
private I1<c1> GetG1(){
g1<c1> oG1 = new g1<c1>();
oG1.Add(new c1());
return oG1;}
private I1<c1> GetG2(){
g2<c2> oG2 = new g2<c2>();
oG2.Add(new c2());
return (I1<c1>)oG2;} ********* see below the error ********
private void TestMethod(){
I1<c1> oTest1 = GetG1();
I1<c1> oTest2 = GetG2();}
****** error ******
Unable to cast object of type 'WindowsApplication2.g2`1[WindowsApplication2.c2]' to type 'WindowsApplication2.I1`1[WindowsApplication2.c1]'
I hope it's less confusing...
|
|
|
|