|
Thanks for the quick reply.
I thought I had to do that, was hoping there was something like...System.Deployment.FirstRun
But not a problem, where theres a will theres a way :->
He who laughs last is a bit on the slow side
|
|
|
|
|
|
Hello
He who laughs last is a bit on the slow side
|
|
|
|
|
hello,
I am using the webbrowser control with c#. The problem I am facing is with javascript popups. I want my browser to behave like IE and display popups and allow toggling location, directories etc display on or off depending on window.open parameters.
Can you give me any pointers as to how I should go about it? If I make the links open in a new instance of the browser, the session data in webpages will no longer be valid....
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
I am trying to create a collection of classes with similarly named functions but different functionality in a DLL.
How can I create an instance of an object at compile time and then assign it a class at run time so that the action can be changed based on a user variable and not an ugly case/switch structure?
|
|
|
|
|
An OO class structure seems the way to do this.
Christian Graus - C++ MVP
|
|
|
|
|
You could implement the State Pattern - it's often a good choice for replacing switch statements, especially if you have them in many methods.
There's an article here:
http://www.codeproject.com/useritems/StatePattern.asp[^]
Or google for "State Pattern".
----------------------------
Be excellent to each other
|
|
|
|
|
Hi, Dear Respected Programmers
1) Kindly let me know, How my I find my any required word or sentense in
RichtextBox?
2) How may I replace characters in text value for example?
KINGBING ==>> KANGBANG
Thank you
|
|
|
|
|
you can use regular expressions to find text in teh richtextbox, and as the text is found, you can replace it with the desired text.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
;PIf I have a form with 5 text boxes on it how to I return the text from the active text box so I can copy it to a string or if the cursor is in a text box how can I paste from the clipboard to the active text box? All examples are very simple in that they all paste to or copy from textbox1 only. I was going to use these but can't figure out how to get the active textbox.
private void CutCopyData()
{
String str1 = null;
Clipboard.SetDataObject(str1);
}
private void PasteData()
{
IDataObject iData = Clipboard.GetDataObject();
//Determine whether the data is in a format you can use.
if (iData.GetDataPresent(DataFormats.Text))
{
string str = (String)iData.GetData(DataFormats.Text);
Thanks Jon Stroh
|
|
|
|
|
try it on the GotFocus() event of the control.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
hi all,
I am able to highlight the syntax when I type the text ie c# code in richtextbox using the following code
code:
// Calculate the starting position of the current line.
int start = 0, end = 0;
for (start = richTextBox1.SelectionStart - 1; start > 0; start--)
{
if (richTextBox1.Text[start] == '\n')
{
start++;
break;
}
}
// Calculate the end position of the current line.
for (end = richTextBox1.SelectionStart; end < richTextBox1.Text.Length; end++)
{
if (richTextBox1.Text[end] == '\n')
break;
}
// Extract the current line that is being edited.
String line = richTextBox1.Text.Substring(start, end - start);
// Backup the users current selection point.
int selectionStart = richTextBox1.SelectionStart;
int selectionLength = richTextBox1.SelectionLength;
// Split the line into tokens.
Regex r = new Regex("([ \\t{}();])");
string [] tokens = r.Split(line);
int index = start;
foreach (string token in tokens) {
// Set the token's default color and font.
richTextBox1.SelectionStart = index;
richTextBox1.SelectionLength = token.Length;
richTextBox1.SelectionColor = Color.Black;
richTextBox1.SelectionFont = new Font("Courier New", 10, FontStyle.Regular);
// Check whether the token is a keyword.
String [] keywords = {"abstract","base","bool","break","byte","case","catch",,...."using","virtual","void" };
for (int i = 0; i < keywords.Length; i++)
{
if (keywords[i] == token)
{
// Apply alternative color and font to highlight keyword.
richTextBox1.SelectionColor = Color.Blue;
richTextBox1.SelectionFont = new Font("Courier New", 10, FontStyle.Bold);
break;
}
}
index += token.Length;
}
// Restore the users current selection point.
richTextBox1.SelectionStart = selectionStart;
richTextBox1.SelectionLength = selectionLength;
But my aim is to write c# code in text file and load that text file into a richtextbox and as soon as i load the text file into richtextbox the syntax should be highlighted.but in my case i am not getting that.
can anyone help me to solve this problem
Don't wait to hear a word of thanks from anybody when you help them instead ask them to help three other people and ask them to continue in chain.
|
|
|
|
|
Hi,
I want to manipulate an ACPI-device via C#/.NET . Having searched the net for a while now, I've been pointed to the System.Management namespace, but I can't find anything useful, I have no experience working with WMI and that namespace.
The goal is pretty simple: I have a laptop with a led, which should be displaying incoming emails. Only that it doesn't work with my current mail program out-of-the-box and the available plugins/addons/etc can't please me. Plus, I'm always into trying something new. So I wanted to write a app, which is independent from my mail-program and checks for mails, then flashes the LED, whenever there's new mail.
Could someone point me to some documentation on that topic (preferred also referring to .NET, examples/code would be great!)?
And just to be complete: The hardware is an ASUS laptop and the name of the "device" (the LED) I want to switch is "/_SB/ATKD/MLED", if that helps in giving me some hints.
Thanks in advance...
Xp
|
|
|
|
|
Hi
I get a web page with boxes (choices) that need to be clicked. I want to click a predetermined box when it comes in. That box may or may not be available or becomes available by changing color. When the right color is present I need to click it.
I am new at C# but I only what examples of how it might be done or at least pointed in the right direction.
I have downloaded the 1 example of an autoclicker that is here. Will investigate.
Thank you for any help you may give.
|
|
|
|
|
Zinc Oianoid wrote: I am new at C#
Then your odds of achieving this are low. Where is the web page coming from ? How do you hope to know what it's color is ( the most likely way is a complex HTML parser, or a screen capture ) ?
Christian Graus - C++ MVP
|
|
|
|
|
Those are the odds I like, makes me look even better when I succeed.
Here are some detail that might help.
It is a scheduling page.
The boxes that need clicking are color coded for available time slots/requested time slots (ones I clicked)/accepted time slots (after clicking).
The following code is cut out of original. It may or may not have bearing. It is not in any particular order.
the code for building the area in question is not visible by using 'source' from the browser. Is there a way to capture more code?
Where I removed/editd code for security reasons I will note it with xxxx and (RFSR).
-----------------------------------------------
<script type="text/javascript">
page.onloads = [];
window.open('https://xxxxx.xxxx/xx.html', (RFSR)
<iframe id="tubesock_iframe" style="position:absolute; top:0px; left:0px; width:100%; height:100%"
src="https://xxxxxxxxxxx.html"></iframe> (RFSR)
-----------------------------------------------
thanks
Bob
|
|
|
|
|
In an asp.net page I need to use inline C# code to display a string in the following format "dddd, MMMM d" and "H:mm t".
I was successful in using the vb format function but the code must be in C# because of other parts of the page. I have been unsuccessful in finding the corresponding method for C#. The vb code that worked:
format(ctype("datetime string in proper format", datetime),"dddd, MMMM d")
In case you're wondering the quoted datetime string is provided by something outside of asp and is not a constant.
If someone can give me the equivalent in C#, I'd be very grateful. I've looked but can't find it.
Thanks,
Mary
|
|
|
|
|
Use DateTime.Parse to parse the string to a DateTime value. Then you can use the ToString method on that value with the format that you want.
Those methods are of course available in VB also, as they are part of the framework. If people just stopped writting VB6 code in VB.NET, it would be so much easier to convert it to C#.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: If people just stopped writting VB6 code in VB.NET
If MS hadn't given them the option, if a bunch of VB6 hacks had not put pressure on MS to ruin VB.NET, etc.
|
|
|
|
|
Thanks, the parse method is what I was missing. It works like a charm.
|
|
|
|
|
The VB code you're using is a VB6 hangover. In both VB.NEt and C#, you should use the ToString method of the DAteTime class and pass in a format string, etc. MSDN has all the details.
|
|
|
|
|
Hi there everyone
I am creating a web based application usiing C#. On the register user page I would like to encrypt the password on the client side. To do this I am using Java Script. However I am uncertain and cant find out how to pass parameters to my JS function So far i have this:
Page_Load()
{
btnSubmit.Attributes.Add("onClick", "encrypt(this.Form)");
}
then the JS is something like this
function encrypt()
{
var key = lblPublic.innerHTML;
var s = txtString.innerHTML;
DoEncrytion(key, s)
}
I am unsure how to what type to pass to encrypt() and just generally unsure of how to make it work.
Any help will be greatly appreciated
Thanks
Dan
|
|
|
|
|
If your variable is in C#, then you need to inject code which creates a jscript variable and sets it to the value you have in your C# code. So, your JS is injected with registerclientscriptblock, and is created to pass the value through
|
|
|
|
|
First of all, why would you encrypt anything client side? Everything that you use for the encryption is visible to anybody, sore there is no security gained.
What is it that you want to pass to the Javascript function? What do you want to happen?
---
b { font-weight: normal; }
|
|
|
|
|
Hi sorry i dont think I was clear enough.
I am using an RSA algorithm so i send my public key to the client side and it is used to encrypt what is stored in a txtBox. I need to know how to pass the txtbox contents to the function
cheers
Dan
|
|
|
|