|
The i <= input.Length should be i < input.Length.
0 Based.
Thank You
Bo Hunter
|
|
|
|
|
|
Hi,
I have a treeview control in a form, which is bound to an imagelist control.
In this tree i have some node with some child node.My problem is when i click on any subnode then it's images will be replace with it's parent node picture or with any other things which you define in the SelectedImageIndex property.but i dont want to have selectedimagesindex property run when i click in any node, i just want to have it fix.
thanx,
best regards
sean
|
|
|
|
|
I have a string value in the registry that i'm trying to read into my app. I need this value to be read as an integer so i can use it in a custom function.
<br />
RegistryKey rk = Registry.Users;<br />
rk = rk.OpenSubKey(@".DEFAULT\CustomForm", false);<br />
int result = calculate(rk.GetValue("GRN1"),2);<br />
<br />
public int calculate(int x, int y)<br />
{<br />
int result = x * y;<br />
return result;<br />
}<br />
The rk.GetValue("GRN1") returns an Object Type, but how can i get it to return an Integer type. I get an 'Invalid Cast' error when i try to cast from a different 'domain' (as msdn calls it)....
int result = calculate((int)rk.GetValue("GRN1"),2);
so, how can i get an object value from the registry to convert to an integer?
Thanks for your help
.gonad.
|
|
|
|
|
Have you tried: Int32.Parse(rk.GetValue("GRN1"),2); ?
That might work.
|
|
|
|
|
Convert.ToInt32(rk.GetValue("GRN1")) should do the trick.
|
|
|
|
|
Hi, is there a way to turn rtf text into html? i.e. bold to <bold>
|
|
|
|
|
even bold to <b>bold</b>
tia
|
|
|
|
|
Try this:
richTextBox1.Rtf = richTextBox1.Rtf.Replace(@"\b0 ", "</b>");
richTextBox1.Rtf = richTextBox1.Rtf.Replace(@"\b ", "<b>");
|
|
|
|
|
Not that I know RTF, but this will seriously break it....
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
This will break if the bold is inside a cluster of RTF codes yes. The principle is the same though. Remove the \b and insert the <b> after the first space after the \b. For the end tag \b0 look for the \b0 and find the first \ in the cluster of those tags and insert the </b> before it:
Example:
\b\ul Test\b0\uln
\ul <b>Test</b>\uln
NOTE: Although there is no other offical RTF code that I am aware of that starts with \b you might want to check to make sure it really is bold and not the begining of something else. Easiest way is to search for "\b " and "\b\" instead of just "\b". That will find the bold tag if it is on the end of a cluster of RTF codes or in the middle. As for the \b0 you can do the same I guess but I can't imagine an RTF ever starting out with \b0.
|
|
|
|
|
I wanna show a html file by default browser.
I know, in Win32, i can call ShellExecute to open a *.htm file directly.
but, in .NET, there is no Win32 APIs,
so, what should i do?
|
|
|
|
|
|
Nishant, thanks
I have got the solution.
here it is.
using System.Diagnostics;<br />
<br />
Process pro = new Process();<br />
pro.StartInfo.FileName = "C:\\test.htm";<br />
pro.Start();
thanks anyway
|
|
|
|
|
Can someone help me with multy form communication ? The question is: If I have 2,3,more... forms visible how can form number 1 send some data (for exmaple: move progress bar) on Form number 2,3,4,more... ?? Sending varibales from one form to another,sharing resources and stuff ??
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
There is more than one way to do this.
1/ You can have a singleton object in your system that will hold data (for example ints) through which these forms will communicate.
2/ If you have a singleton, one form could fire an event when it wishes to communicate data, the singleton have an event handler, and then invoking a method on form2 to set the variable.
|
|
|
|
|
1. Make the progress bar Public.
2. To the form number 1 give the references to forms 2,3,4...
3. Use the reference to move progress bar.
The refenrences can be passed as a constructor parameter or kept as a static array.
|
|
|
|
|
Like this ?
<br />
<br />
Form frm2 = new MyNamespace.Form2();<br />
frm2.Show();<br />
++frm2.progressBar1.value;<br />
This is what you mean ?
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
Yes. This is what I meant. Of course this relates to Windows forms, not Web forms.
|
|
|
|
|
But in this case I have to make progressBar1 on Form2 - static !
<br />
public static ProgressBar progressBar1;<br />
otherwise I can not see it
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
You can not see it because you use general type to reference your form. Consider the example:
Form frm1 = new MyFormWithProgressBar();
frm1.Show();
frm1.progressBar1.Value++;
The correct code is:
MyFormWithProgressBar frm1 = new MyFormWithProgressBar();
frm1.Show();
frm1.progressBar1.Value++;
Sorry that I have not noticed that mistake in your previous post.
|
|
|
|
|
Nice.. 10x
[Do you know how to make form transperent / non-standart shape ?]
"I have not failed.
I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
|
|
|
|
|
Everyone, I'm in the process of developing what can be accurately
called a chat system, and I'm running into a problem that I just can't figure out:
My client login window (the GUI elements themselves are typical, and I don't think
they're relevant) grabs hold of a remote factory object (subclass of MarshalByRefObject),
and that factory respects the following interface:
namespace MyCompany.Interfaces
{
public delegate void WelcomeEvent(string username);
public delegate void DismissEvent(string username);
public interface ISessionFactory
{
void OpenSession(string username, WelcomeEvent welcomeEvent, DismissEvent dismissEvent);
void CloseSession(string username, WelcomeEvent welcomeEvent, DismissEvent dismissEvent);
}
}
The connect button of my Login Window fires off the following delegate when clicked:
private void OnConnectButtonClicked(object sender, EventArgs e)
{
if (usernameText.Text.Length == 0) return;
string username = usernameText.Text;
RemotingConfiguration.Configure("client.config");
ISessionFactory factory =
(ISessionFactory) Activator.GetObject(typeof(ISessionFactory),
"http://localhost:5007/SessionFactory");
FriendsWindow buddylist = new FriendsWindow();
WelcomeEvent welcomeEvent = new WelcomeEvent(buddylist.WelcomeUser);
DismissEvent dismissEvent = new DismissEvent(buddylist.DismissUser);
factory.OpenSession(username, welcomeEvent, dismissEvent);
buddylist.Show();
this.Visible = false; // hide login window
}
When OnConnectButtonClicked is fired, I see a FileNotFoundException thrown from inside
buddylist.Show();
claiming that it can't find the ChatClient assembly, or the assembly of one of its dependencies.
Information relevant to the FriendsWindow class
FriendsWindow is a subclass of Form
Not surprisingly, it defined methods WelcomeUser and DismissUser, and each (as you
can see) are compatible with my WelcomeEvent and DismissEvent delegate types.
FriendsWindow and LoginWindow (the class defining the above) are both defined within
the same namespace.
It's defined within a project named ChatClient.csproj.
That project's default namespace: ChatClient (though all of my classes are
placed in a namespace I call MyCompany.ChatClient)
That project's assembly name: ChatClient
What's odd to me? If I comment out the factory.OpenSession() line, the program
properly displays my FriendWindow in response to the Show message. It's as
if the act of calling OpenSession causes the problem on the very next line.
I've not tried very much, because I'm still in that denial which allows me
to think that I'm right and that there's just a bug in the compiler.
However, I *have* inspected all of the namespace declarations and whatnot
to ensure that there're no typos, and as far as I can tell, there are none.
Any help or general comments as to where I should look for help would
be greatly appreciated.
Best,
Jerry
|
|
|
|
|
hi,
The MDI layout for child MDIforms works fine for upto 3 child windows, i.e., the Horizontal, Vertical and the Cascade layout for the child windows works fine.
But for more than 3 MDIchild windows, the Horizontal and Vertical Layout doesn't work?
Any clue's about this?
Thanks,
Peenu.
|
|
|
|
|
Hi
I read a field of type Image from a SQLServer database. Now, what I want to do is creating a System.Drawing.Image object and holding my retrieved image into it. How?
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|