|
Hi,
Is there a tutorial around for making skinned apps like winamp in C#? (I mean how can i make good looking and different UI s?)
Thanx...
|
|
|
|
|
In C# resource editor let say I am putting a label string say "Hello Label".
Resource editor generate the code for it in InitializeComponent() like
this.lblMessage.Text = "Hello Label";
I am coding for multiple languages (German/French). So it create lot of
problem for me. I have to change all these lines to
this.lblMessage.Text = resManager.GetString("txtHello");
I am storing all these messages in a MyApp.resx files and maintaining a
separate .resx file for each language like for German there is a
MyApp.de.resx and setting the UICulture in my code.
Is there any simpler way for this?
Sonork ID 100:25668
|
|
|
|
|
I think you can do the same thing using the properties editor. First set the Localizable property on the form to true, then set the form's Language property to the first language. Now proceed to set all of the properties that need localized strings. Then change the Language property to the next language, and change all of the localized strings, repeat.
I did this while playing around a couple months ago and it seemed to produce what you want.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Thank you James
Sonork ID 100:25668
|
|
|
|
|
Hi all,
How can I fix the TextBox height permanently? If we change the font size, the height of the TextBox changes accordingly. But in the OpenFontDialog , we have a TextBox [which displays the sample/preview], for which the height remains permanent, even when the font size is high. How can we do this ?
Thanks
Smitha
It is better to be hated for what you are than to be loved for what you are not.
-- Andre Gide
|
|
|
|
|
Smitha Vijayan wrote:
How can we do this ?
I think you are looking for the AutoSize property.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Thanks James
Smitha
It is better to be hated for what you are than to be loved for what you are not.
-- Andre Gide
|
|
|
|
|
Message to Chew Keong TAN, who asks:
"The following positive pseudoprime and several others passes our implementation of primality test but failed in JDK's isProbablePrime test. Any advice on why this is so would be greatly appreciated".
James Wanless replies:
"I'm primarily a mathematician, rather than programmer, but think I may have an answer for you - I have discovered that the Miller-Rabin Test is (effectively) seriously WRONG (sic) [please see my original posts on sci.math for the logical/math reasoning behind this discovery - copyright JGW 2000 or thereabouts ]. It greatly underestimates the chance that a number it calls prime is actually composite (ie the chance of each false witness is >> 1/4, unlike as claimed). Unfortunately for it, too, the discrepancy worsens with increasing size of number tested.
This means, in practice, that if two different M-R implementations (eg yours and JDK) use different specific witnesses there is a non-negligible chance that results will differ, both in the way you describe, and also probably in the reverse direction.
Fortunately, however, I have developed a suitable (both fast and accurate - especially for big numbers) replacement for M-R. A java implementation of this I have published (with source code) at:
http://www.bearnol.pwp.blueyonder.co.uk/Math/Prime/Primeda.html
Feel free to use/incorporate this into your own programming, provided appropriate (math) credit is given...
"
Best regards,
James
http://www.bearnol.pwp.blueyonder.co.uk/
|
|
|
|
|
Hi All,
Quick question: Does the = 's operator work on TabPages ? I have a program where I create an empty TabPage , I then create another TabPage and add a bunch of controls to it. Then basically I replace the empty page (or it may be a page with controls on it already) with the page I just created, but using the = 's operator doesn't seem to work. If I use the Add method for the TabPages property it works fine. Is there special trick I need to do in order to get = 's to work.
Thanks in advance.
|
|
|
|
|
It sounds like you are assigning the reference to the new TabPage to the variable that references the old TabPage, instead you need to do something like:
myTabControl.TabPages[oldPageIndex] = myNewTabPage;
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
That's exactly how I'm doing it, but it just doesn't seem to work.
Thanks for the response though.
- monrobot13
|
|
|
|
|
I have a VS.net solution that has:
- server project
- client project
- shared library
- shared library 2
The server project publishes both shared library and the second shared library for remoting. The client properly registers itself to use the remoting objects. The client can successfully use the remoting objects.
Here is the question: I want shared library 2 to be able to access the remoting object “Shared library” by using remoting. I add all the necessary references. But – when I try to register the class as a client for remoting (by doing :
System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(typeof(Shared.MySharedClass), "http://127.0.0.1:8080/shared");
It fails with a remotingexception.
Is it possible to access other remoting objects from an object that is published for remoting?
|
|
|
|
|
I am trying to send lines of hex file to commPort wit the serial communication.
I am trying the StreamReader and ReadLine and using textfile to do this job.
My hex file is an Intel hex format for example look like below.
TextFile
:0341000002410079
:0B410000E4C2E8C2E9C2EAC2EB80FEA4
:00000001FF
I have no problem to build this example soultion.
but I get an error when I try to bress button (Sndf3) button.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at BaseTerm.SndF3(StreamReader fr) in baseterm.cs:line 174
at TermForm.SndF3_Click(Object sender, EventArgs e) in termform.cs:line 662
Any suggestion or code help will be great.
Salam Hamid
-----------------------------------------------------------------------------------
Her is My C# code.
baseterm.cs
public void SndF3(StreamReader fr)
{
string input ;
while((input = fr.ReadLine()) != null)
{
for(int i =0; i < (fr.ReadLine().Length); i++) // Line 174
{
Send((byte)input[i]);
}
frm.ShowMsg("Hex Line OK...");
}
}
//----------------------------------------------------------------------------------
termform.cs
private void SndF3_Click(object sender, System.EventArgs e)
{
StreamReader fr = File.OpenText("P401CR.hex");
BaseTerm.term.SndF3(fr); // Line 662
fr.Close();
}
|
|
|
|
|
Use StreamReader.Peek() rather to so the EOF, ReadLine() wont garenteee anything.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Adding on to what leppie said.
You are getting a null reference exception due to a simple misconception.
while((input = fr.ReadLine()) != null)
input is now equal to the line that was read from the stream, the important point is that line has been removed from the stream. So now the next line of code will eventually fail because:
for(int i =0; i < (fr.ReadLine().Length); i++)
Your loop reads in one line from the stream until it crashes or i is greater than the length of the last line read in (keep in mind you are reading in a line every time through the loop).
What you probably meant to write was:
for(int i =0; i < (input.Length); i++)
So that you process the line of input read in at the start of the while loop.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Thank you James and leppie.
I used
for(int i =0; i < (input.Length); i++)
it works now.
Salam;)
|
|
|
|
|
Where can I find info on implementing time trials and registration keys in my programs?
|
|
|
|
|
|
|
Hello,
I am developing the application in compact framework using c#.I want to create the dynamic menu which will take values from database and on clicking on the menuitems (retrieved from database) certain functioning should happen.Can anybody tell me how should I achieve the event handling for this?
I am pasting the code herewith:
for(int i=0;i<arrmenu.length;i++)
{
="" query="select description from configMaster where tableName='Menu' and tblId=" +="" arrmenu[i];
="" record.open(query,con);
="" menuitem="" mymenu="new" menuitem();
="" mymenu.text="record.Fields[0].Value.ToString();
" mymenu.click="" eventhandler(mymenu_click);
="" menuitem1.menuitems.add(mymenu);
="" record.close();
="" }
="" }
="" private="" void="" mymenu_click(object="" sender,="" eventargs="" e)
="" <u="">I AM NOT ABLE TO DETECT HERE WHICH MENUITEM IS CLICKED.
//MessageBox.Show(mainMenu1.MenuItems.GetEnumerator().Equals(sender).ToString());
}
|
|
|
|
|
newtocsharp wrote:
I AM NOT ABLE TO DETECT HERE WHICH MENUITEM IS CLICKED.
[edited]
It should be obvious that, since you add an event handler at the menu item level, not at the menu level, that you must create and attach a new event handler to each menu item :
myMenu.Click += new EventHandler(myMenu_Click1);
... // ith iteration
myMenu.Click += new EventHandler(myMenu_Click2);
... // i+1 th iteration
myMenu.Click += new EventHandler(myMenu_Click3);...
[/edited]
(useless)
|
|
|
|
|
But even though you have to add an event handler to each item seperately, you can respond to multiple objects' events in one pprocedure. Use the sender argument to find out which item raised the event.
|
|
|
|
|
Hello,
Thanks for the reply.I have tried with sender.getType().getDefaultMember()
but getting an 'indexOutofRangeException'
Can you help me out which sender property shall I use to find the item.
|
|
|
|
|
private void myMenu_Click(object sender, System.EventArgs e)
{
int nIndex = this.menuItem1.MenuItems.IndexOf( (MenuItem)sender );
String s = this.menuItem1.MenuItems[nIndex].ToString();
MessageBox.Show("you've clicked on " + s);
}
|
|
|
|
|
Is it possible to use IO Completion Ports in C# or MC++? If so any suggestions on where to start?
-BestSnowman
|
|
|
|