|
Oh wow, I feel so stupid.
Turns out I had the wrong TextBox written out.
Pardon me for my newbie miss.
The code works now.
Thanks a ton!
|
|
|
|
|
I have days like that as well!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
It's nice that you found it. Let this be a lesson to you. ALWAYS give your controls nice names that mean something. Don't ever use the default names, like "TextBox1".
|
|
|
|
|
Can we implement CSS on a Window Form if yes how?
|
|
|
|
|
|
Hi all.
Interested in such a thing:
Is it possible to do block allocation (as in the pictures) in WinForms RichTextBox?
If you can, then about how this is done?
p.s. know what is being done through OnPaint, Graphics.. but how exactly is the drawing of a border on the sides?
Example
|
|
|
|
|
lMr Cirwosl wrote: but how exactly is the drawing of a border on the sides? If you want to know how it is done "exactly", then you'll need the source-code of the app you are showing.
And no, that's not a simple RichEditControl with some code that you can copy/paste. Google for the name in the caption, and you'll see that it is a commercial control.
lMr Cirwosl wrote: but how exactly is the drawing of a border on the sides? Drawing a border is not hard. Rechecking on each keypress if you need to repaint isn't hard either. Having it in an edit-control that performs nicely is hard.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
What this picture shows, I wanted to show others what I had in mind under the block allocation, and not how this control was done, and the standard whether it is or not.
And about the method itself.
And what's the keystroke?
As if the text selection is done by gripping and moving the mouse, not the keyboard keys (except for Ctrl+A)
|
|
|
|
|
lMr Cirwosl wrote: As if the text selection is done by gripping and moving the mouse The picture doesn't show a block-selection. And yes, you can do that with the mouse, the RichTextBox supports that. It does not support block-selections out of the box.
Click before the word "if", hold and drag upto the end of the selection. The keycombination to do so would be to hold down shift while using arrow/ctrl keys to make the selection.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
That is syntax highlighting in a code editor. It is done by rendering the text, measuring the text on the screen and drawing round it. This is usually done in a control you develop yourself, and by overriding the OnPaint method. However, it is worth doing a Google search first to see if there are any source code samples around.
|
|
|
|
|
Moreover, there is syntax highlighting? I'm talking about the style of highlight lines in the RichTextBox, but not about syntax highlighting. The example I show the picture in the middle of the selected row, that's the style for me.
|
|
|
|
|
|
Hello,
I am not an expert in C# but this site helped a lot creating a mini application that launches IE9, modifies some registry keys and bingo. Now, I have to add a few modifications but launch IE11.
This is the code:
RegistryKey key00 = RegistryKey.OpenRemoteBaseKey(RegistryHive.CurrentUser, "");
RegistryKey subkeyAA = key00.OpenSubKey("Software\\Microsoft\\Internet Explorer\\BrowserEmulation\\ClearableListData", true);
string[] namesAA = subkeyAA.GetValueNames();
string YesUserFilter = "";
string NoUserFilter = "";
foreach (string name in namesAA)
{
if (name.Equals("UserFilter", StringComparison.CurrentCulture))
{
YesUserFilter = "1";
break;
}
else
{
NoUserFilter = "1";
}
}
if (YesUserFilter == "1")
{
int myValue = (int)subkeyAA.GetValue("UserFilter");
if (myValue != 0)
{
subkeyAA.SetValue("UserFilter", "company.com", RegistryValueKind.Binary);
}
}
if (NoUserFilter == "1")
{
subkeyAA.SetValue("UserFilter", "company.com", RegistryValueKind.Binary);
}
subkeyAA.Close();
But the conditionals of YesUserFilter or NoUserFilter are blank, Thoughts ? Thanks for your help.
|
|
|
|
|
Hi,
The first thing I would look at is the MissingManifestResourceException .
It seems that, in your WindowsFormsApplication1 project, there's a problem with a resource file.
There can be several causes; could you check that, for every .resx file in your project, there is a .designer.cs file associated?
Is Form1 marked as localizable? If so, there must also exist some relative resource files.
Another thing to do would be to put a beakpoint on the first line of Form1's constructor, and pressing F11 line by line to find which one, in InitializeComponent() method, throws the exception.
Hope this helps.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
|
|
|
|
|
Thank you i think i figured it out
|
|
|
|
|
I fixed that part i had to change the string name variable to something else, it was bringing another value from the top.
But on this section:
subkeyAA.SetValue("UserFilter", "company.com", RegistryValueKind.Binary);
I get ArgumentException was unhandled
{"The type of the value object did not match the specified RegistryValueKind or the object could not be properly converted."}
|
|
|
|
|
I also facing the same issue in the coding.. Can anyone help out in this issue
|
|
|
|
|
I am in the process to get a code signing certificate but there are some things I am not too sure about..
1st they ask me what kind of certificate I want, either of:
---
Adobe AIR
Sun Java
Multi-platforms
Mozilla
Microsoft Authenticode
Microsoft Macros and VBA Macros
---
I want a .pfx that can sign my .msi file! Would it be a "Microsoft Authenticode"?
Then they ask me a Company Name & Division!
I am working on my take over the world at home I my free tie at the moment, haven't have a company yet!
Should I register one? (what would be the 'division' anyway?)
Further it would be an Australian company name, how would that help a world wide certificate?
|
|
|
|
|
Not sure about the first question but regarding the company name I'd say just give them your full name. They need to put something into the company field, I don't think they actually care whether you have a company or not.
|
|
|
|
|
Super Lloyd wrote: I want a .pfx that can sign my .msi file! Would it be a "Microsoft Authenticode"? It may be all of them, simply different suppliers and different prices.
Super Lloyd wrote: (what would be the 'division' anyway?) Just one of the things that is shown on the certificate. Shows roughly the same things as an internet-certificate. Go to GMail, click on the lock next to the URL and check it out.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
My instructor and I disagree on a mark that she gave me an assignment on generics. According to the requirements stated below, could someone tell me if my could meets these requirements.
Here is the requirements:
Write a generic method, Search, that implements the linear-search algorithm. Method Search
should compare the search key with each element in its array parameter until the search key is
found or until the end of the array is reached. If the search key is found, return its location in the
array; otherwise, return -1. Write a test app that inputs and searches an int array and a double array.
And here is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GenericsTest
{
class MyArrayList
{
int CountInt2 { get; set;}
int CountInt1 { get; set;}
int CountDouble2 { get; set; }
int CountDouble1 { get; set; }
int[] integerArray;
double[] doubleArray;
public MyArrayList()
{
CountInt1 = 0;
CountInt2 = 0;
CountDouble1 = 0;
CountDouble2 = 0;
integerArray = new int[5];
doubleArray = new double[5];
}
public void SetArrayInfo(int number)
{
integerArray[CountInt1] = number;
++CountInt1;
}
public void SetArrayInfo(double number)
{
doubleArray[CountDouble1] = number;
++CountDouble1;
}
public int Search<T>(T number)
{
if (number.GetType() == typeof(int))
{
while (CountInt2 <= integerArray.Length)
{
if (CountInt2 < integerArray.Length)
if (integerArray[CountInt2].Equals(number))
{
Console.Clear();
Console.WriteLine("The number " + integerArray[CountInt2] + " was found in array index number: " + CountInt2);
Console.WriteLine();
CountInt2 = 0;
return -2;
}
++CountInt2;
}
return -1;
}
else if (number.GetType() == typeof(double))
{
while (CountDouble2 <= doubleArray.Length)
{
if (CountDouble2 < doubleArray.Length)
if (doubleArray[CountDouble2].Equals(number))
{
Console.Clear();
Console.WriteLine("The double " + doubleArray[CountDouble2] + " was found in array index number: {0}", CountDouble2);
Console.WriteLine();
CountDouble2 = 0;
return -2;
}
++CountDouble2;
}
}
return -1;
}
}
class DriverProgram
{
static void Main(string[] args)
{
int numberInt;
double numberDouble;
int choice = 0;
MyArrayList myArrayList = new MyArrayList();
myArrayList.SetArrayInfo(8);
myArrayList.SetArrayInfo(9);
myArrayList.SetArrayInfo(5);
myArrayList.SetArrayInfo(10);
myArrayList.SetArrayInfo(21);
myArrayList.SetArrayInfo(7.7);
myArrayList.SetArrayInfo(3.30);
myArrayList.SetArrayInfo(9.80);
myArrayList.SetArrayInfo(12.3);
myArrayList.SetArrayInfo(21.58);
do
{
Console.WriteLine("1 Get Integer Array Index");
Console.WriteLine("2 Get Double Array Index");
Console.WriteLine("3 Exit");
try
{
Console.Write("Choose one: ");
choice = Convert.ToInt32(Console.ReadLine());
}
catch (FormatException e)
{
Console.WriteLine("You have entered an invalid type");
Console.WriteLine("Error: " + e);
}
if (choice == 1)
{
try
{
Console.Clear();
Console.Write("Enter integere number: ");
numberInt = Convert.ToInt32(Console.ReadLine());
int answer = myArrayList.Search<int>(numberInt);
if (answer == -1)
Console.WriteLine("The ID number entered was not found.");
}
catch (FormatException e)
{
Console.WriteLine("You have entered an invalid type");
Console.WriteLine("Error: " + e);
}
}
else if (choice == 2)
{
try
{
Console.Clear();
Console.Write("Enter double number: ");
numberDouble = Convert.ToDouble(Console.ReadLine());
int answer = myArrayList.Search<double>(numberDouble);
if (answer == -1)
Console.WriteLine("The ID number entered was not found.");
}
catch (FormatException e)
{
Console.WriteLine("You have entered an invalid type");
Console.WriteLine("Error: " + e);
}
}
else if (choice == 3) { Console.Clear(); }
else
{
Console.Clear();
Console.WriteLine("The choice you made is Invalid");
}
Console.WriteLine("Press any key to continue....");
Console.ReadKey();
Console.Clear();
} while (choice != 3);
}
}
}
</<pre lang="c#"> pre>
According to my instructor's feed back, my work was among some of the worst work submitted in class. I think my program meets my instructors requirements stated above.
Any feedback would be welcome.
If I do not thank you right away it is because I'm busy in school
Thanks,
Truck53
|
|
|
|
|
Your search function isn't generic at all. You are specifically testing for int and double inside the function. What happens if you call
SearchArray<long>(5L) or
SearchArray<String>("Test") ?
I think you were supposed to write a function with a signature like this:
int SearchArray<T>(T[] Array, T itemSearched)
You could have coded this function as member of the DriverProgramClass. Or if you insisted on creating an extra class MyArrayList for encapsulation, it should have been Generic (i.e. with a T[] member, instead of int[] and double[]) as well.
Besides, what does this comment about the student array mean? Did you just copy this somewhere else and slightly change it?
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
|
Hello,
Thank you for answering my question. I was particularly interested with your commit. You said that my method was not generic at all and that I should have used a generic array of type T. Does the generic array create two types of arrays and access them at run time? If this is true, I could understand why people might be a little edgy with my code. But, if you look at the requirements, the instructor says that two arrays are to be used, one for double and one for integer; At least that is what I interpreted when I read "an integer and a double"The sentence she uses does not explicitly imply the use of a generic array. In fact, the only time the word generic is used is when the instructor refers to the Search method. And, the only way I could think of using two arrays of the type specified by my instructor is to compare the type passed by the my generic method at run time then traverse through the array and compare the key to the value in the array. I learned in college that a lot of projects fail because developers fail to meet the user’s requirements. I think assuming that a generic array was to be used when according to what the instructor wrote, the use of two array of the primitive type integer and double was implied. I would encourage you to take a good look at what my instructor wrote in the requirements and not just go by what you think is the best way to code. Hit me up and let me know what you think. If I’m wrong then I’m wrong.
And, about the student commented out code. I originally had a class with properties that held information like student ID and Student name etc. But, I took a second look at the instructor’s requirements and decided to keep it simple. I hope this answers your question.
Peace,
Truck53
Peace.
|
|
|
|
|
The instructor is right, by definition: and arguing with him / her will not help in the future.
Remember: the same person will be marking your next effort, so annoying them is not a good idea.
And that is poor: it doesn't look like you understood the concept of generics at all - or indeed even tried particularly hard. I can't comment on if it's absolutely the worst: I've only seen two examples from your class (the other is here[^] and at least the other tried to use generics a little.
I suggest that you have a close look at all the comments on the other example, and the rather more mature way in which your classmate handled it...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|