|
Actually let me explain the problem in detail. Actually i am developing an ink based application. So i need to develop a transparent form where on which i can write on it. But when i set the opacity even the ink is becoming transparent. So i thought not to use this property.
I read somewhere in other groups that when a form is created it is created normarly with out WS_EX_TRANSPARENCY property set. Even setting the opacity does not set the value. So i thought of creating a form of this type and can write on it.
I hope this explains quite a bit why i am looking forward in this direction.
vinod
|
|
|
|
|
I don't know how to use Threads in C#.
I want to check if a website is loaded or not. If not loaded, wait for 3 secs and check again. If still not loaded do something.
Please help me with some pointers.
Thanks in advance
Vishal...
|
|
|
|
|
In C# there are function pointers which are nothing but DELEGATES
so delegates, which is used to reference to your objects.
With asynchronous programming, the caller must define the delegate when calling a method, if the caller uses a delegate.
mahes
|
|
|
|
|
Look for the Thread class in the System.Threading namespace. Creating a thread is as simple as instantiating a new Thread instance and calling Start on it.
You might also want to look into the BeginInvoke method, which you can call on any delegate.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
In Form1.cs I have defined the "InstituteAdministrator" class which contains ListView "listViewAddress". In a second file (FormTreeView.cs) I have the class FormTreeView with the method "dataTreeView1_AfterSelect". When the user selects a node in the treeview, then listViewAddress should be filled and displayed with the corresponding addresses.
As long as I keep the whole thing in one file, it works fine, but not with two files and two classes.
I want to use dotnetmagic.com's libraries, which come with this two-files example for docking.
First I created a method within the InstituteAdministrator class which establishes the database connection and fills the listview. Within FormTreeView class I made a reference to the Institute Administrator class and called the filling method I defined, passing "e.Node.Tag.ToString()" as parameter to the method.
The program seemed to work, however the data is not displaying in the listview. Since then I'm trying out (try and error...). So far I did not find sufficient information in books or online examples to help me to understand what is going on. (needless to say that I'm a newbie)
Which are the steps to make this work? Any hints, anyone?
Link to screenshots and source-files:
http://www.osswald.com/vstudio/[^]
Direct link to source files (flash-paper prints):
http://www.osswald.com/vstudio/images/form1.cs.swf[^]
http://www.osswald.com/vstudio/images/FormTreeView.cs.swf[^]
|
|
|
|
|
Hello,
I have a combobox, which is a DropDownList (can't type inside the box)
with values: a, b, and c for example. Is there an event, that will be triggered only when the text changed, if value of combobox was a and new value is b, fire event. However, if value was a and user picks a again, don't fire event.
Thank you.
|
|
|
|
|
DropDown event Occurs when the drop-down portion of a ComboBox is shown.
we can use the event when the text changed in the combobox.
This event is raised if the Text property is changed by either a programmatic modification or user interaction.
private void currencyTextBox_TextChanged(object sender, EventArgs e)
{
try
{
// Convert the text to a Double and determine if it is a negative number.
if(double.Parse(currencyTextBox.Text) < 0)
{
// If the number is negative, display it in Red.
currencyTextBox.ForeColor = Color.Red;
}
else
{
// If the number is not negative, display it in Black.
currencyTextBox.ForeColor = Color.Black;
}
}
catch
{
// If there is an error, display the text using the system colors.
currencyTextBox.ForeColor = SystemColors.ControlText;
}
}
mahes
|
|
|
|
|
I'm new bie to C# application..here is my requirement goes,
(a) I want to search a particular keyword inside a file.
(b) let say, if a file contains text "this is sample program...". If i search "sample" inside a file, it should give the exact matching.
(c) any prior articles for the same..?
-------code
FileStream fs = new FileStream("C:\\a.txt", FileMode.Open, FileAccess.Read);
StreamReader fs1 = new StreamReader(fs);
String mystring="sample";
while (string == fs1. _ ___ )
{
Messagbox.show("Yes i got ur string ..");
}
---------
please reply this incomplete prog..snippet.
|
|
|
|
|
Read N chars (N = length of the string you're matching) from the filestream into a test string. Test the buffer against the search string. If they don't match delete the leading character from the test string, read a single character from the file, append it to the test string and test again. repeat until you find a match or reach the end of the file.
|
|
|
|
|
public bool FindMyText(string text)
{
// Initialize the return value to false by default.
bool returnValue = false;
// Ensure a search string has been specified.
if (text.Length > 0)
{
// Obtain the location of the search string in richTextBox1.
int indexToText = richTextBox1.Find(text);
// Determine whether the text was found in richTextBox1.
if(indexToText >= 0)
{
returnValue = true;
}
}
return returnValue;
}
mahes
|
|
|
|
|
|
I have a combobox and is populated from a datatable. The problem is that I have in my table rows with the same value for that column so I want that in combobox to appear that values only once because when I select a value from the combobox my datagrid to display only the lines with that value in the specified column. The combobox stores the months and in my datagrid I want to display the items from that specified month. I will show my code below:
public FModificareDate()
{
InitializeComponent();
conAccess.Open();
daMembrii.Fill(odsDate, "tb_membrii");
daUnitate.Fill(odsDate,"tb_unitate");
DataTable dataTableMembrii = odsDate.Tables["tb_membrii"];
#region Definire coloane datagrid Membrii
//Setarea numelor coloanelor din datagrid
// create a DataGridTableStyle object and initialize
// based on the dataTable's TableName.
DataGridTableStyle tableStyleMembri = new DataGridTableStyle( );
tableStyleMembri.MappingName = dataTableMembrii.TableName;
// Get the GridColumnsStylesCollection
// from the table style's GridColumnStyles collection
GridColumnStylesCollection columnStylesMembri = tableStyleMembri.GridColumnStyles;
// Make a columnStyle object and add column info to it
// then add the columnStyle to the columnStyles collection
DataGridColumnStyle columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_codcmr";
columnStyleMembri.HeaderText = "Cod CMR";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_codparafa";
columnStyleMembri.HeaderText = "Cod Parafa";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_cnp";
columnStyleMembri.HeaderText = "CNP";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_nume";
columnStyleMembri.HeaderText = "Nume";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_prenume";
columnStyleMembri.HeaderText = "Prenume";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_luna";
columnStyleMembri.HeaderText = "Luna";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_an";
columnStyleMembri.HeaderText = "Anul";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_suma";
columnStyleMembri.HeaderText = "Suma Totala";
columnStylesMembri.Add(columnStyleMembri);
GridTableStylesCollection tableStylesMembri = dgMembri.TableStyles;
tableStylesMembri.Add(tableStyleMembri);
#endregion
dgMembri.DataSource = dataTableMembrii;
DataTable dataTableUnitate = odsDate.Tables["tb_unitate"];
#region Definire coloane datagrid Unitate
// create a DataGridTableStyle object and initialize
// based on the dataTable's TableName.
DataGridTableStyle tableStyleUnitate = new DataGridTableStyle( );
tableStyleUnitate.MappingName = dataTableUnitate.TableName;
// Get the GridColumnsStylesCollection
// from the table style's GridColumnStyles collection
GridColumnStylesCollection columnStylesUnitate = tableStyleUnitate.GridColumnStyles;
// Make a columnStyle object and add column info to it
// then add the columnStyle to the columnStyles collection
DataGridColumnStyle columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "unit_id";
columnStyleUnitate.HeaderText = "ID";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "unit_tip";
columnStyleUnitate.HeaderText = "Tip";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "unit_denumire";
columnStyleUnitate.HeaderText = "Nume Unitate";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_tara";
columnStyleUnitate.HeaderText = "Tara";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_secjud";
columnStyleUnitate.HeaderText = "Sector/Judet";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_localitate";
columnStyleUnitate.HeaderText = "Localitate";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_tip";
columnStyleUnitate.HeaderText = "Tip Adresa";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_denumire";
columnStyleUnitate.HeaderText = "Denumire";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_codpostal";
columnStyleUnitate.HeaderText = "Cod Postal";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_nr";
columnStyleUnitate.HeaderText = "Nr";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_bloc";
columnStyleUnitate.HeaderText = "Bloc";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_scara";
columnStyleUnitate.HeaderText = "Scara";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_etaj";
columnStyleUnitate.HeaderText = "Etaj";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_apartament";
columnStyleUnitate.HeaderText = "Apartament";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_compladresa";
columnStyleUnitate.HeaderText = "Completari Adresa";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_fix1";
columnStyleUnitate.HeaderText = "Telefon Fix1";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_fix2";
columnStyleUnitate.HeaderText = "Telefon Fix2";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_fax";
columnStyleUnitate.HeaderText = "Fax";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "persc_nume";
columnStyleUnitate.HeaderText = "Nume Persoana Contact";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "persc_prenume";
columnStyleUnitate.HeaderText = "Prenume Persoana Contact";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "persc_tel";
columnStyleUnitate.HeaderText = "Telefon Persoana Contact";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_nr";
columnStyleUnitate.HeaderText = "Indicator control";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_tot";
columnStyleUnitate.HeaderText = "Total";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_luna";
columnStyleUnitate.HeaderText = "Luna";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_an";
columnStyleUnitate.HeaderText = "Anul";
columnStylesUnitate.Add(columnStyleUnitate);
GridTableStylesCollection tableStylesUnitate = dgUnitate.TableStyles;
tableStylesUnitate.Add(tableStyleUnitate);
#endregion
dgUnitate.DataSource = dataTableUnitate;
txtMembri.Text = dataTableMembrii.Rows.Count.ToString();
dSumaCotizatii = 0;
for(int i=0; i
|
|
|
|
|
Hi,
I am working on the treenodes in C# and am facing a prob. I want to dynamically populate treenode with a filename immediately after saving a file in a particular folder. Can I do this without writting any seperate function.
Or is there any other way?.
Looking forward for some help.
Thanks and Regards
KR
|
|
|
|
|
Hi All,
I was not able to display complex classes in the propertygrid and hence had to use UITypeEditors for doing that.
I am actually trying to display the properties of a class object inside the property grid which has another class object as one of its property .(can go deep)
The problem is that the object which is the property is getting grayed out even though i am using UITypeEditor (Comboboxlisteditor) to do so.
So no point in thinking of more deeper object properties.
I have tried all places to search for such a code which has a propertygrid displaying complex classes and enums . I could not find one .
So please spare some time and pass on some simple code which can display complex class objects and enums inside the propertygrid .I just need the minimum . I have referred to MSDN and few other articles from codeproject which was helpful to a certain extent but not for this problem .
I have spent more than 3-4 days in researching the things on this .
Please help me in getting it done .
Thanks and Regards,
DJ
|
|
|
|
|
|
Thanks for that Leppie.
But i dont want to use typeconverters, rather i would like to use custom type editors to solve my problem . wish i can get some piece of sample code which is tested having the required attributes.Because the attribute is not being able to pick up properly which is as follows
[Editor("WindowsFormsPropertyBag1.Form1.ComboBoxListEditor",typeof(System.Drawing.Design.UITypeEditor))]. Do you need more information about the problem??.
Thanks and Regards,
IianforCodeProject
|
|
|
|
|
Good Day People,
I have a DLL. It takes in some parameters, and returns some output. This DLL has to be called form a EXE, which has a GUI Interface.
The portion of code where the DLL returns the solutin is pasted below.
The doubt is; when I call the DLL it returns "n" solutions. I need to take the first solution and show output, while the DLL should be proessing the other solutions.
So I think I should be raising an event, that outputs the first solution. I dot know how to handshake between my EXE and DLL properly. Can you assist?
------------------------------------------------
Code:
------------------------------------------------
forward = true;
while (!myStack.IsEmpty())
{
if (forward)
{
CurrentPtr = -1;
}
else
{
CurrentPtr = (int) myStack.Pop();
CurrentSolution.RemoveAt(myStack.Count);
myArray.RemoveAt(CurrentSolution);
}
CurrentWord = this.Problem.NthWord(myStack.Count);
strExistingWord = myArray.GetStringAt(CurrentWord);
myDict = (Dict) Dicts[myStack.Count];
newPtr = myDict.GetWord(strExistingWord,CurrentPtr, ref strNewWord);
if (newPtr != -1 )
{
CurrentWord.Word= strNewWord;
CurrentSolution.AddWord(CurrentWord);
myStack.Push(newPtr);
myArray.StoreAt(CurrentWord);
forward = true;
if(myStack.Count == this.ProblemSize)
{
Solution newSolution = CurrentSolution.Clone();
this.alSolutions.Add(newSolution);
//return;
// newSolution.writeSolution();
// System.Console.ReadLine();
forward = false;
}
}
else
{
forward = false;
// show the combinations
//this.show(myStack.ToArray());
//System.Console.Write("{0} ", ShowInPC(myStack.ToArray(),Dicts));
}
}
return;
Md. Sathik
|
|
|
|
|
Good Day People,
I have a DLL. It takes in some parameters, and returns some output. This DLL has to be called form a EXE, which has a GUI Interface.
The portion of code where the DLL returns the solutin is pasted below.
The doubt is; when I call the DLL it returns "n" solutions. I need to take the first solution and show output, while the DLL should be proessing the other solutions.
So I think I should be raising an event, that outputs the first solution. I dot know how to handshake between my EXE and DLL properly. Can you assist?
------------------------------------------------
Code:
------------------------------------------------
forward = true;
while (!myStack.IsEmpty())
{
if (forward)
{
CurrentPtr = -1;
}
else
{
CurrentPtr = (int) myStack.Pop();
CurrentSolution.RemoveAt(myStack.Count);
myArray.RemoveAt(CurrentSolution);
}
CurrentWord = this.Problem.NthWord(myStack.Count);
strExistingWord = myArray.GetStringAt(CurrentWord);
myDict = (Dict) Dicts[myStack.Count];
newPtr = myDict.GetWord(strExistingWord,CurrentPtr, ref strNewWord);
if (newPtr != -1 )
{
CurrentWord.Word= strNewWord;
CurrentSolution.AddWord(CurrentWord);
myStack.Push(newPtr);
myArray.StoreAt(CurrentWord);
forward = true;
if(myStack.Count == this.ProblemSize)
{
Solution newSolution = CurrentSolution.Clone();
this.alSolutions.Add(newSolution);
//return;
// newSolution.writeSolution();
// System.Console.ReadLine();
forward = false;
}
}
else
{
forward = false;
// show the combinations
//this.show(myStack.ToArray());
//System.Console.Write("{0} ", ShowInPC(myStack.ToArray(),Dicts));
}
}
return;
|
|
|
|
|
HI
I'm beginner in C# Builder, And need to know how I can read from textbox or richtextbox.
And how I should draw Function like (y=sin(x)), IN VB usually drawing is in picturebox,
but I'm not very familiar with C# structure. I need the source code, cause I Havn't enough
time now to learn it, I should learn it later. if you can guide me.
thank you.
TA RedStar
|
|
|
|
|
|
Hello again! I'm on the last stretch of my 1st ever c# program and I really need help in solving this last, yet possibly hardest problem i've encountered yet.
Well I have this program that saves the output of my query in a datagrid into text file. I've accomplished half of it meaning I can save it at a target location but:
1. Why can I only save it in specific folders like c:\Temp? I'm hoping I could save it on the desktop.
2. Why doesn't a command prompt appear when I click the save button? It save directly and doesn't even inform the user that it has been saved although it already is.
3. How do I solve this problem?
I've tried searching the net for possible solutions but failed. Here's my code:
private void btnSave_Click(object sender, System.EventArgs e)
dtMain = objBM.fMain(DropDownList1.SelectedItem.Value,DropDownList2.SelectedItem.Text);
StreamWriter sr = File.CreateText("c://Temp//SSS.txt");
string strout;
if (dtMain.Rows.Count > 0)
{
for (int intptr = 0; intptr <= dtMain.Rows.Count - 1; intptr++)
{
strout = " ";
for (int intptr2 = 0; intptr2 <= dtMain.Columns.Count - 1; intptr2++)
{
strout += dtMain.Rows[intptr].ItemArray[intptr2] + " ";
}
sr.WriteLine(strout);
}
}
sr.Close();
}
Any and all suggestions, reactions and informations would be greatly appreciated. Thanx for all your helps!
thanx
|
|
|
|
|
1) you can save it anywhere you choose to - try searching for Environment.SpecialFolders.Desktop to find out more about getting the desktop directory. At the moment you are creating a file in the specific path with this line - StreamWriter sr = File.CreateText("c://Temp//SSS.txt");
2)If you want a dialog to appear try looking into the saveFileDialog control (it should be on the toolBox by default)
Then you could use the FileOk event of this control to save the file to wherever the user has selected.
|
|
|
|
|
Are there some compiler or .NET framework predefined macros, such as the _ATL_VER, _MFC_VER, _MSC_VER for the C#?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Macros suck, I regret that C# supports them at all. Yes, I believe there is DEBUG for debug versions, and TRACE also. They are shown in the project properties for a debug build, you can add more.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks.
I do not see what is regretable about macro support in C#. You simply do not have to use what you do not have a use for. I needed to create an interface library for both .NET 1.1 and 2.x, and do not want to do this again. So, I want to have something like
#if version 1.x
IPositionList Positions
#else // version 2.x
List<IPosition> Positions
#endif
{
get;
}
where is a IPositionList is a strongly-typed list of IPosition for use in
the version 1.x.
I do not know if anything else can do this better than macros. I will defined my own macros - just trying to find out if "standard macros" exist
for this kind of stuff.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|