|
In my win-form, I am binding a textbox to a property, populated through my object. The property returns a number. Let's say 55.5
I want to add a % sign at the end of this 55.5 without changing the decimal or any of the significant figures.
How can i do it?
Here is what i know so far:
In the binding panel in the text property, under the "Format type" menu, there is a "Custom" option. It has Custom format textbox. If we put the % sign in here in a correct way, it will just be added to the end of the value of the property. So far, 0.0% or 0.00% has not worked as it changes the decimal and significant figures.
Any insight will be appreciated.
|
|
|
|
|
Are you adding this for a wildcard in SQL?
Or do you just want it to "display" with a percentage when they are done with the text box?
Do you want to show a confirmation with a percent sign?
-----------------------------------------------------------
Completion Deadline: two days before the day after tomorrow
|
|
|
|
|
I just want a "%" sign with the number to identify it as a percentage value.
|
|
|
|
|
Put a label next to the text box that says "%"
|
|
|
|
|
well this way, % would be always displayed even if the values have not come back. If, you have some method based on the form control, then that would be helpful.
Thanks
|
|
|
|
|
In your original post you wrote, "The property returns a number. Let's say 55.5" Would it possible to change your property from whatever "number" type it is (double , decimal , etc.) to string type? That way you could control the significant digits and add the '%' character to the end of the string.
BDF
|
|
|
|
|
You want to add a % sign as a suffix to the content of a textbox?
yourTextBox.Text += "%";
Cheers,
Vıkram.
Be yourself, no matter what they say.
- Sting, Englishman in New York.
|
|
|
|
|
Thanks Vikram,
textBox name is txtPVSav
In the textbox property definitions, I added the following after the textbox binding code.
this.txtPVSav.Text += "%";
But the textbox content only displays the numerical value.
|
|
|
|
|
Ok guys,
I just figured this out.
In the binding panel in the text property, under the "Format type" menu, there is a "Custom" option. It has Custom format textbox. Add the 0.00 "%" in the Custom field.
This will append a % sign at the end of the numberical value and you will still be able to use that property as a numerical input to other parts of your program.
Thanks Vikram for initial headway
|
|
|
|
|
ArrayList temp = new ArrayList();
foreach (string var in Request.Form)
{
temp.Add(var);
}
This is the code I'm using to pull out the items in my form. However, I cannot seem to get the values of the data entered into the form. I'm just getting the names of all the objects in the form, but I really want the data as well. Am I missing something?
-----------------------------------------------------------
Completion Deadline: two days before the day after tomorrow
|
|
|
|
|
Request.Form returns NameValueCollection.
you should do this:
foreach (String var in Request.Form.Keys)
temp.Add(Request.Form[var]);
Hope I helped.
|
|
|
|
|
Hi All,
I have created a SQLBuilder class as a wrapper to the ADO2.0 SQLite implementation.
It uses refection for automatic database insert, update, delete and select.
Here is the link.
http://www.handymandy.ca/component/option,com_remository/Itemid,62/func,select/id,12/
Usage:
[dbTable("tblComputers",false)]
public class Computer2
{
private string m_Name;
private int m_Id;
private ProcessorType m_CpuType;
private int m_MemorySize;
public Computer2()
{
//connects to default database
SqlBuilder.Instance.connect();
}
[db(false,"Name","text","",false)]
private string Name
{
get { return m_Name; }
set { m_Name = value; }
}
[db(true, "Id", "int", "", false)]
private int Id
{
get { return m_Id; }
set { m_Id = value; }
}
[db(false, "Cpu", "int", "0", false)]
private ProcessorType Cpu
{
get { return m_CpuType; }
set { m_CpuType = value; }
}
[db(false, "MemorySize", "int", "0", false)]
private int MemorySize
{
get { return m_MemorySize; }
set { m_MemorySize = value; }
}
public void Insert()
{
try
{
SqlBuilder.Instance.verifyTableExists(this);
SqlBuilder.Instance.insert(this);
}
catch (ApplicationException e)
{
}
}
public void Update()
{
try
{
SqlBuilder.Instance.update(this);
}
catch (ApplicationException e)
{
}
}
public void Delete()
{
try
{
SqlBuilder.Instance.delete(this);
}
catch (ApplicationException e)
{
}
}
public void Select()
{
try
{
SqlBuilder.Instance.select(this);
}
catch (ApplicationException e)
{
}
}
}
|
|
|
|
|
Hello
Does anyone have an example of how to expose a C# EventHandler so that VBScript can hook up to it? It must be VBScript. I can call methods on this very basic class, but can't get the event hooked up. This is a Class Library and is built with the "Register for COM Interop" switch set.
<br />
public class Talker<br />
{<br />
public event EventHandler SomeNeatEvent;<br />
private System.Timers.Timer EventTicker = new System.Timers.Timer();<br />
<br />
public Talker()<br />
{<br />
EventTicker.Interval = 2000;<br />
EventTicker.AutoReset = true;<br />
EventTicker.Enabled = false;<br />
EventTicker.Elapsed += new System.Timers.ElapsedEventHandler(EventTicker_Elapsed);<br />
}<br />
<br />
void EventTicker_Elapsed(object sender, System.Timers.ElapsedEventArgs e)<br />
{<br />
if (SomeNeatEvent != null)<br />
{<br />
SomeNeatEvent(this, new EventArgs());<br />
}<br />
}<br />
<br />
public void ToggleTickerEnabled()<br />
{<br />
EventTicker.Enabled = !EventTicker.Enabled;<br />
}<br />
}<br />
Thank you for your time and ideas
Patrick
-- modified at 13:20 Monday 27th August, 2007
|
|
|
|
|
Hello,
If I declare the following (or something like this....)
Graphics^ g = CreateGraphics();
Pen pen = new Pen(Color::Green)
g.DrawLine(%pen, 10, 10, 20, 20);
It won't work without the "%". Is this a "tracking reference"?
So my question is what is the "%" really doing?
thanks a lot
|
|
|
|
|
This is a C++ question and this is a C# forum.
|
|
|
|
|
DisplayBitmap = new System.Drawing.Bitmap(camera.width, camera.height, stride, System.Drawing.Imaging.PixelFormat.Indexed, camera.MonocromeFrame);
This gives me an invalid argument (System.Drawing.Imaging.PixelFormat.Indexed)
DisplayBitmap = new System.Drawing.Bitmap(camera.width, camera.height, stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, camera.MonocromeFrame);
gives me the image but it is 3 times as wide and just repeats
|
|
|
|
|
tried
<br />
<br />
Bitmap temp = new System.Drawing.Bitmap(camera.width, camera.height, stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, camera.MonocromeFrame);<br />
<br />
DisplayBitmap = new Bitmap(temp.Width,temp.Height);<br />
<br />
for(int y=0;y<DisplayBitmap.Height;y++)<br />
<br />
{<br />
<br />
for(int x=0;x<DisplayBitmap.Width;x++)<br />
<br />
{<br />
<br />
Color c=temp.GetPixel(x,y);<br />
<br />
int luma = (int)(c.R*0.3 + c.G*0.59+ c.B*0.11);<br />
<br />
DisplayBitmap.SetPixel(x,y,Color.FromArgb(luma,luma,luma));<br />
<br />
}<br />
<br />
}
and it lagged beyond compare because it is a huge image.
The board retarded my for loops
here is a link to the code No Paste version of the code [^]
|
|
|
|
|
Wondering how to disconnect my LAN through C#... though there is a way through WMI but any alternate and better solution would be appreciated thanks
Determination and faith are the only keys !
|
|
|
|
|
There is no keyword in C# or class/method in the .NET framework to directly achieve this. You may have to build your own, probably by using the System.Management [^] namespace in the framework, since there is way through WMI.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
thanks for taking interest
The problem is, through system.management, i can only get the status of whether the Network Card is enabled or Disabled. The solution is only if the DHCP gets unleased, but thats not the right way i guess. What I want to do is to achieve the Disabling Network Card as i use to do by going in Network connection and disabling it through right click and selecting the particular option "Disable"
Any idea how to do that ?
Determination and faith are the only keys !
|
|
|
|
|
There are a few ways you can do this, below is the easiest method with a WMI script converted to C#;
http://channel9.msdn.com/ShowPost.aspx?PostID=158556[^]
If you download his application (the [Save] link at the bottom of the top post) he included the source code...
|
|
|
|
|
thanks for the reference
Determination and faith are the only keys !
|
|
|
|
|
AssemblyName _tempname = new AssemblyName();
_tempname.Name = "MyTempAssembly";
AssemblyBuilder _Assmblybuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(_tempname, AssemblyBuilderAccess.RunAndSave);
ModuleBuilder _modBldr = _Assmblybuilder.DefineDynamicModule("MainMod", "MyTempAssembly.dll");
string x = "System.Windows.Forms.Button";
TypeBuilder _typeBldr = _modBldr.DefineType(x);
I want to make object of the Type inside _typeBldr ... how?
|
|
|
|
|
Hi
I am using a VB6 application which has embedded Excel sheet in one of its forms.
I am developing a new Web Application in C#/ASP.net 2.0 where the requirement is to save some data in a webpage and then to show the same data (just saved in Web App) in the Excel sheet of the VB6 application.
Problem is I dont know how to refer VB6 application from .Net
Please help me ASAP.
Vinay
|
|
|
|
|
If the VB 6 app reads data stored in excel format then save the data from the web form with an excel format. Then the VB6 app can show the data given the file.
If I see ur problem correctly
|
|
|
|