|
Thanks for the help. I thought I had looked everywhere, but apperantly not.
![Big Grin | :-D](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_biggrin.gif)
|
|
|
|
|
I have a string that will have a negative number as either the first 2 or 3 characters of it (including negative sign) immediately following this there is a colon :
How can I copy everything before this initial colon into another variable.
Reason for this: I need to perform some mathematical manipulation on this value but there is no way for me to get at it but via string because of the special characters.
Thanks
********************
* $TeVe McLeNiThAn
********************
|
|
|
|
|
|
That's what it is. Thank you so much. I have done the same thing before but couldn't remember it exactly.
Thanks again!
********************
* $TeVe McLeNiThAn
********************
|
|
|
|
|
Hi all
Is that possible to rearrange the order of delegates attached to an event and/or is it possible to enumerate them (without firing them)
thankx
|
|
|
|
|
Could you give an example of what you are trying to implement?
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
its not me - but I'll try and explain
a friend is adding a delegate to an event which already has other handlers on it - what he wants to do is put his handler to run first and then let the others go
Technically speaking the dictionary would define Visual Basic users as programmers. But here again, a very generalized, liberal definition is being employed and it's wrong - just plain wrong - Tom Archer 5/12/02
|
|
|
|
|
|
I'm using the following code to export from a database to Microsoft Excel but I have one problem: The first record in the database is not getting exported correctly, any one can tell me why?
Many Thanks,
Jassim Rahma
string myConnString = ConnectionString;
OdbcConnection cn = new OdbcConnection(myConnString);
cn.Open();
cn.ChangeDatabase(TableName);
DataSet ds = new DataSet();
OdbcDataAdapter da = new OdbcDataAdapter(SQLstatement, cn);
da.Fill(ds, TableName);
if (MessageBox.Show("Do you want to Export the data?", "Export", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string MyString;
StreamWriter myTextStream = new StreamWriter(txtOutput.Text);
for (int i= 0; i < ds.Tables[0].Columns.Count-2; i++)
{
MyString = ds.Tables[0].Columns[i].ToString() + ", ";
}
MyString = ds.Tables[0].Columns[ds.Tables[0].Columns.Count-1].ToString();
myTextStream.WriteLine(MyString);
MyString = "";
System.Data.DataTable tb = ds.Tables[0];
for (int i = 0; i < tb.Rows.Count-1; i++)
{
System.Data.DataRow dr = tb.Rows[i];
for (int j = 0; j < dr.Table.Columns.Count-2; j++)
{
MyString = MyString + dr[j].ToString() + ", ";
}
MyString = MyString + dr[dr.Table.Columns.Count-1].ToString();
myTextStream.WriteLine(MyString);
MyString = "";
}
myTextStream.Close();
myTextStream = null;
Process p = new Process();
System.Diagnostics.ProcessStartInfo pi = new ProcessStartInfo();
pi.UseShellExecute = true;
pi.WindowStyle = ProcessWindowStyle.Hidden;
pi.FileName= txtOutput.Text;
p.StartInfo = pi;
p.Start();
}
cn.Close();
cn.Close();
}
Jassim Rahma
|
|
|
|
|
I have a small doubt.We can see the debug combobox & font combobox at the top of the dotnet IDE.I want to add my own textbox.I know it is possible to do via addin.But will it come under commandbar or anyother thing.
|
|
|
|
|
I'm using C# to host a Flash file. This requires the flash object. When I build the executable, it creates 2 Dll's that are required for the program to run. Is there a way to compile the Dll's with the executable so that the program is self-contained? 2nd question: I am compiling on 2000 pro. Will users on other platforms be able to run this? 3rd: is .NET framework required on other machines in order for the app to run?
|
|
|
|
|
granthnk wrote:
1.there a way to compile the Dll's with the executable so that the program is self-contained?
Yes. Use the AxImporter.GenerateFromFile class (where the file is the Flash ActiveX object). Before you can use AxImporter, you need to import the System.Design.dll namespace.
granthnk wrote:
2. : I am compiling on 2000 pro. Will users on other platforms be able to run this?
Not Win95.
Provided you don't use ADO.NET, ASP.NET, users will be able to run your app with the sole .NET run-time installed. ( In addition, be sure to compile against .NET 1.0, otherwise you have to provide a .config file. )
granthnk wrote:
3. is .NET framework required on other machines in order for the app to run?
Yes, the .NET run-time is required. That's a major show stopper for small apps these days.
|
|
|
|
|
How do you get a control reference from it's handle under .Net? ![WTF | :WTF:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_WTF.gif)
|
|
|
|
|
From MSDN:
Control.FromHandle Method
See Also
Control Class | Control Members | System.Windows.Forms Namespace | Handle | Parent
.NET Framework Security:
UIPermission for all windows to call this method. Associated enumeration: UIPermissionWindow.AllWindows
Returns the control that is currently associated with the specified handle.
public static Control FromHandle(
IntPtr handle
);
Parameters
handle
The window handle (HWND) to search for.
Return Value
A Control that represents the control associated with the specified handle; returns a null reference (Nothing in Visual Basic) if no control with the specified handle is found.
WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.
|
|
|
|
|
Hi folks,
I'm just beginning with C#. I am doing an RPN calculator and it seems to work pretty well.
However I have a problem. I have a class that manages the stack, and a class that manages the displaying of numbers on the display, that actually is a TextBox, tbDisplay.
Since the TextBox in on the main form, the one that gets created automatically when you use the form designer, I have to access it from the display class. How do I do it?
What I did is declaring the TextBox public static. After from the display class I access it using Form1.tbDisplay. It works!
The problem is that everytime I add a control, or do "something", something being I don't know exactly what, the TextBox disappears. It seems that VisualStudio removes the lines of code. What VS does is not removing the declarations of the control, public static etc..., but it removes the lines in the initialization. It removes the line from the this.Controls.AddRange.
It also removes these lines:
Calc.tbDisplay = new System.Windows.Forms.TextBox();
// tbDisplay
//
Calc.tbDisplay.Location = new System.Drawing.Point(136, 56);
Calc.tbDisplay.Name = "tbDisplay";
Calc.tbDisplay.Size = new System.Drawing.Size(208, 20);
Calc.tbDisplay.TabIndex = 18;
Calc.tbDisplay.Text = "0";
Calc.tbDisplay.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
This happens all the times. It's the tenth time I add the lines back by hand, it's a mess.
What's the problem here? I suspect that my approach of declaring it static.. etc it's not the right solution? How should it work???
How do I, from inside Z class, control an istance of a X class that is declared into Y class?
Thanks for any help.
I hope to finish my calc so maybe I can post my first arcticle on CodeProject. It uses a nice stack class. And it behaves exactly like the calculator I am emulating, the HP 12C.
Edward
|
|
|
|
|
I don't think declaring a control as static is valid!
The code you show is generated by (and deleted by) the form designer. If it doesn't like your declaration it will probably strip the control on code generation.
i.e. the code that the form designer creates.
Calc.tbDisplay = new System.Windows.Forms.TextBox();<br />
<br />
Calc.tbDisplay.Location = new System.Drawing.Point(136, 56);<br />
Calc.tbDisplay.Name = "tbDisplay";<br />
Calc.tbDisplay.Size = new System.Drawing.Size(208, 20);<br />
Calc.tbDisplay.TabIndex = 18;<br />
Calc.tbDisplay.Text = "0";<br />
Calc.tbDisplay.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
|
|
|
|
Thanks for the hint, I was pretty sure that there was something wron, even if it actually worked!
But it seems that now I have a problem that I don't know how to solve.
I have a class Display that I use to perform all the stuff related to the display, that actually is my control box. For example I need this class because it keeps track whether when the user pushed a button he's beginning a new number or adding a digit to the number currently onscreen. Things like that.
The problem is that I don't know how to access the control that is on the form. You know they are in two different classes. Of course I cannot inside class Display write tbDisplay.Text = "whatever"; nor Form1.tbDisplay; etc.
How this is supposed to work?
Thanky you a lot!
Edward
|
|
|
|
|
Hi everybody!
Whenever I try to instanciate an XmlSerializer I get an FileNotFoundException thrown at me (from mscorlib.dll) with the following information:
File or assembly name hflbt5w2.dll, or one of its dependencies, was not found.
Funny thing is, that each time I run the code the dll-name is a different one!
Can anybody please advise?
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
|
Hi Leppie,
thanks for your reply. I'm trying just a very simple class. Something like this:
class Test {
// ctors omitted for brevity
public Size _Size;
public Point _Point;
public string _String;
}
I instanciate and set some values, after that I try to serialize the class, but it simply won't work...
thanks again!
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
|
Hi Leppie,
not, the class is not public, in fact it is a (private) nested class. The serialization stuff is in it's parent class, which is public. And yes, the class has a default ctor.
While I'm writing this I'm trying to write another simple sample. I'll post it here if it doesn't work but let you know otherwise.
Thanks again!
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
Hi Leppie,
so, here we go... As mentioned in my last post, the class which I want to serialize is nested and private in it's containing class. Thats the problem. As soon as it's been made public, no problem there. It just ruined my design...
a lot of wind for a small boat...
Anyway thanks for your help!!!
Matthias
In theory, there is no difference between theory and practice. In practice, however, there is.
(unknown author)
|
|
|
|
|
leppie wrote:
Sounds like those files ASP.NET makes.
The XML serializer works by creating an Assembly at runtime that handles the serialization of the types to/from XML. Because it generates an Assembly, you wind up with the weird naming scheme.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|