|
Marc Clifton wrote:
Automatic validation, BTW, is one of the lamest, most poorly implemented features of .NET. I'm not even sure why I'm using it! It must have been by written by some highschool dropout on a bender.
Hahaha, that must be quite some guy??
Doesn't the this.DialogResult = DialogResult.Cancel work?
|
|
|
|
|
Eduard Keilholz wrote: Doesn't the this.DialogResult = DialogResult.Cancel work?
I'll have to try that, even though these are modeless forms (not displayed with ShowDialog). Which I guess is why I didn't even think of trying that.
Marc
|
|
|
|
|
Eduard Keilholz wrote: Doesn't the this.DialogResult = DialogResult.Cancel work?
Just got around to trying it. Nope, doesn't work. I'm having the validator find the control that has focus and checking the CausesValidation button. Fortunately, all my validators go through one validation event.
Marc
|
|
|
|
|
Hey, i have a question...
I'm writing a program, it goes like the following:
it reads every line in the txt file as one option, and you can select those options, let's say the resolution of, and after that it writes the value to another file (a settings.ini for example), then boots the specified program with that changed value.
it's like:
Settings.txt:
<br />
640x320<br />
800x600<br />
1024x768<br />
1200x1024<br />
1600x1200<br />
and so on.
now how can i make the .txt file be shown in the listview, and how can i define every line as 1 option?
|
|
|
|
|
This should come close....
<br />
StreamReader sr = new StreamReader("path\to\file", FileMode.Open);<br />
<br />
string sLine = sr.ReadLine();<br />
<br />
bool Loop = (sLine.Length > 0);<br />
while (Loop)<br />
{<br />
ListItem li = new ListItem(sLine);<br />
listName.Items.Add(li);<br />
sLine = sr.ReadLine();<br />
Loop = (sLine.Length > 0);<br />
}<br />
sr.Close();<br />
|
|
|
|
|
FileMode.Open is an inacceptable overload =x
|
|
|
|
|
Hi,
this will get you started:
string[] stringArray=File.ReadAllLines(@"path\to\file");
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Does anyone know any API to install fonts to windows folder?
On XP I used to just copy those to windows/fonts folder, but it does not work on vista.
There is windows API AddFontResource, but it only installs font until user reboots computer.
Thanks.
|
|
|
|
|
You can add fonts to your setup & deployment project and then register it as font..
|
|
|
|
|
I need to do it programmatically.
|
|
|
|
|
I did not need to register the new font. I copied the new font file into the directory during the install. XP and Vista found it and listed it in the font selection dialog with no problems.
did not know that i had to register the font in anyway
|
|
|
|
|
I think i have the same problem. I want to copy the a font file by using my program, but the only thing i managed until now is to register the font file vie AddFontResoucre so openoffice can use it until my pc reboots. I tried to get write permissions by using FileIoPermission for the font-Directory but when my program actually copies the file to the directory it says i dont have the permission to do so.
My code looks like this:
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
f2.AddPathList(FileIOPermissionAccess.Read, fontPath);
try
{
f2.Demand();
System.IO.File.Copy(fontPath, destination);
}
catch (SecurityException se)
{
MessageBox.Show(se.ToString());
}
catch (UnauthorizedAccessException ex)
{
MessageBox.Show(ex.ToString());
}
<pre>
|
|
|
|
|
hi Frnds
I want to call the .dll file created by c#.net. in one of my vb application
after creating the dll ,i am giving the reference of this Dll in my vb application ,but i am not able call the methods of this dll.
Please help me , or give me some good tutorial Link
Thanks in advance
«·´`·.(*·.¸(`·.* *.·´)¸.·*).·´`·» ©
*.¸¸.·´¨` »*Vicky*«´¨`·.¸¸ .*
«·´`·.(*.·´(¸.·* *·.¸)`·.*).·´`·»
|
|
|
|
|
What errors are being returned? Also, why don't you use VB.NET?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
i am not getting any error.
i am not able to call the functions of that Dll
«·´`·.(*·.¸(`·.* *.·´)¸.·*).·´`·» ©
*.¸¸.·´¨` »*Vicky*«´¨`·.¸¸ .*
«·´`·.(*.·´(¸.·* *·.¸)`·.*).·´`·»
|
|
|
|
|
Did you add a reference to the dll?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
The only way you can use newer technology like C# via obsolete technology like VB6, is to use something that VB6 knows about. In this case, this means you need to create a COM DLL in C#, and then VB6 can call it via COM.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i am able to take the reference of that dll.
i am not able to rectify either the problem with the dll creation or taking ref.
i have a c#.net project .i am creaing the dll using this.
the procss i am following:
1)tlbexp (to create typelib)
tlbexp ComInteropExample.DLL /out:ComInteropExample.tlb
2)regasm
regasm ComInteropExample.DLL /tlb: ComInteropExample.tlb
after this i m taking the ref of the .tlb file in my vb project.
i am not able to call the function inside.
Plz help
«·´`·.(*·.¸(`·.* *.·´)¸.·*).·´`·» ©
*.¸¸.·´¨` »*Vicky*«´¨`·.¸¸ .*
«·´`·.(*.·´(¸.·* *·.¸)`·.*).·´`·»
|
|
|
|
|
Hi All,
If you have a control (such as a textbox) which is placed inside any type of panel that has it's AutoSize property set to true, and the AutoSizeMode set to grow and shrink,
then when you ErrorProvider.SetError on it, the panel does not grow and as a result, the error icon is clipped.
Does anyone know a solution to this? it's driving me up the wall!
Thanks
Jon
|
|
|
|
|
I'm Looking for a control similar to ListBox, but it would be a little different. You would see the options that you can choose from on one side (preferably left), and then you would see what you've selected in the list on the box on the right hand side of control. You would be able to move the items back and forth by double clicking on them, or clicking on arrows that would move them. I've seen this type of control used multiple times, and so I figure it must be in the .Net framework, but I can't think of what it's called to find it.
Thanks for the help.
|
|
|
|
|
No, it doesn't exist. This control, as you describe it, is made of 2 listboxes and 2 buttons, one for move left to right and one for move right to left.
You can of course create your own custom control and render in it 2 listboxes and 2 buttons.
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
You could use the standard listbox control for this. Just create 2 list boxes, and place them side by side. have 2 buttons in the middle "->" and "<-". In the button mousedown control, check to see if something is selected in the list box. If there is, get the item in the list box, and add it to the other side. All the "magic" here is done by the buttons.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Erhm, I think that selecting kind of thing is a misterious kind of cooperation between controls, events and code! You can even try this at home!!
Right click your projects and choose Add > User Control
Drag two listboxes on the newly create control which you named whatever you want...
Place one listbox in the left, the other one aligns right, make sure to leave some space in between the boxes for some buttons...
name the left listbox lstOptions, the right listbox we name lstSelection...
Now place four buttons aboce eachother between those lists
name the first one btnAddAll
The second one btnAdd
the third one btnRemove
and the last one btnClearSelection
Now create a function which will add a listitem to a listbox
private void AddItem(ListItem Item, ListBox Box)
{
// Your code
}
then doubleclick the btnAddAll and enter the following code :
<br />
foreach (ListItem itm in lstOptions)<br />
{<br />
lstOptions.Items.Remove(itm);<br />
lstSelection.Items.Add(itm);<br />
}<br />
Then add quite similar code behind the other buttons... You've just create your own control!!!
|
|
|
|
|
I want to write a methode where i can deliver named parameter like this
<code>private void MethodeName( aVar = 10, bVar = "20", cVar = 30, <PropertyName> = <value>, ... ){}</code>
where aVar, bVar and cVar are properties of the class.
I saw know that at Attributes....and i hope there is a way to achieve this with normal methods. If not then i need to know how can i do something similar.
thx
|
|
|
|
|
Standard CLR languages do not support this, but nothing can stop you from
creating a new language and a compiler for it.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|