|
"you can make Form2's constructor take an instance of Form1"
I didn't succeed in doing this )-: do you have an example, maybe?
|
|
|
|
|
This is not an insult - abandon this project now. You should not be working on someone elses code, you should be reading a couple of basic programming books.
Having said that,
private Form1 form1;
public Form2(Form1 theForm)
{
form1 = theForm;
}
// Hide the default constructor.
private Form2(){}
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a lot of experience with software programming, but not at all with this language. but I can't abandon it. )-':
anyway, thank you very much for your helping!
|
|
|
|
|
Anonymous wrote:
I have a lot of experience with software programming, but not at all with this language. but I can't abandon it. )-':
Fair enough. I'd have expected the languages you could know without knowing how to modify a constructor would be limited. Either way, do it properly, or pay the price later.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Can somebody make the regex expression described below for me?
Consider the following "main" string...
Day,Amount,Direction;3,100,West;5,43,North;5,44,North West;7,54,South;2,5995,East;,,;,,;,,;54,35345,;,543,North;6,,West
Can you make an expression that will match each groupe of 3 items inbetween the semicolons? Example matches would be..
Day,Amount,Direction<br />
3,100,West<br />
5,43,North<br />
5,44,North West (Make sure you preserve the space)<br />
7,54,South<br />
2,5995,East<br />
,,<br />
,,<br />
,,<br />
54,35345,<br />
,543,North<br />
6,,West
The expression should be along the lines of this: (.*?),(.*?),(.*?)(?=; ) , that's all I could come up with. In engish I want the regex to do this:
Match any number of words, including nothing(seperated by a comma)Match any number of words, including nothing(seperated by a comma)Match any number of words, including nothing(ended with a semi-colon, but don't include in the match)
The main premise here is the "including nothing".
So If I run the expression "5,," against the "main" string above it should return 2 matches:
5,43,North<br />
5,44,North West (preserve white space)
It would return those because the expression would match the words in the expresion and if it's blank it would match anything.
Another example, if I ran ",Day," against the "main" string it would return 1 result:
Day,Ammount,West , if I ran "3,100,West" it would return 1 match, etc.
It would really help if somebody could figure out an expression to match something like this. If you have any questions just ask.
Thanks.
/\ |_ E X E GG
|
|
|
|
|
I thought I did this already :
([^,]*,[^,]*,[^,]*);
this will match all but the ;, you can put a ? next to the ; to make it optional,
([^,]*,[^,]*,[^,]*);?
If you replace [^,]* with Day, for example, then you get the match you're looking for. ( you get a search as well ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I didn't know it would work again in this way. One thing though... Is there a way to exclude the ";" from the matches? The question mark didn't work. I'm running it on this string...
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
I didn't know it would work again in this way. One thing though... Is there a way to exclude the ";" from the matches? The question mark didn't work. I'm running it on this string...
The question mark makes the ; optional. The brackets create a group which excludes the ;. It's $1.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
OH, and by the way. For some reason it skips the last group in the string Day,Amount,Direction;3,100,West;5,43,North;5,44,North West;7,54,South;2,5995,East;,,;,,;,,;54,35345,;,543,North;6,,West
/\ |_ E X E GG
|
|
|
|
|
([^,]*,[^,]*,[^;,]*);?
This matches the last group. The ? means the ; is optional, without it, you won't match the last group.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
([^,]*,[^,]*,[^;,]*);?
Is this the final expression I should use? Because, you posted a couple and I'm confused. This particular expression when ran against this string ...
Day,Amount,Direction;3,100,West;5,43,North;5,44,North West;7,54,South;2,5995,East;,,;,,;,,;54,35345,;,543,North;6,,West
... returns all the groupes of three correctly.
Day,Amount,Direction;
3,100,West;
5,43,North;
5,44,North West;
7,54,South;
2,5995,East;
,,;
,,;
,,;
54,35345,;
,543,North;
6,,West
However, I would like to be able to replace a part of the expression with a number or a word, eg.
(5,[^,]*,[^;,]*);?
(Day,[^,]*,[^;,]*);?
([^,]*,44,[^;,]*);?
([^,]*,[^,]*,North West);?
([^,]*,[^,]*,North);?
Day, Ammount, Direction
etc...
It might help to visualize the above string as an HTML table (because that's what it is)
Can you tell me how to use your expression to do queries like above?
/\ |_ E X E GG
|
|
|
|
|
Don't worry about the last message i can just add a semi colon to the end and it works. But can you make it so it won't include the semicolon in the match?
/\ |_ E X E GG
|
|
|
|
|
To reiterate:
([^,]*,[^,]*,[^;]*);?
This matches all including the ;. $1 is the group within the match that doesn't include the ;.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I would like to use this expression, but I'm am confused about how to modify it for use with this input string:
Day;Amount;Direction
How would the regex change? would it be:
([^;]*;[^;]*;[^;]*)
/\ |_ E X E GG
|
|
|
|
|
IS it possible to integrate c# with PHP?
|
|
|
|
|
One way, but not the other. As php is not a compiled language, c# can not directly call php code. A php page might be able to use a dll written in c#.
C#.net pages and php pages can work in the same web. Interaction between the pages has to be done using querystrings, cookies, files or database, though.
---
b { font-weight: normal; }
|
|
|
|
|
Depends on what you mean by "integrate". There is no limit to the number of "modules" your web server can process. A web server can host ASP.Net with C# code behind as well as have PHP.
So what do you mean by "integrate"? Web applications written in ASP.Net can live besides PHP web applications. As long as you keep the abstraction at the Http level, web applications can "talk" to each other just fine. If you were thinking they could share data structures below web queries/posting though that is not possible.
|
|
|
|
|
trying to embed a legacy COM dll in c# form. ABle to create the object but not able to dereference one of it's fields. It should be a float array -->
GSpcIOLib.GSpcIO myspc = new GSpcIOLib.GSpcIO();
myspc.OpenFile("c:\\work\\honeydew.spc");
object xfloat = myspc.XPoints;
if I view xfloat in the debugger I can see the array of floats but if I try and do something like this float myfloat = xfloat[1]; I get an error -->
Error 1 Cannot apply indexing with [] to an expression of type object
|
|
|
|
|
You can't do much with an object without specifying what it really is. If you have an array of floats, you can either access it by casting the object to a float array:
myfloat = ((float[])xfloat)[0];
or by declaring xfloat as a float array:
float[] xfloat = myspc.XPoints;
---
b { font-weight: normal; }
|
|
|
|
|
Is there a way to write to Notepad from c# without creating a file.
I need this because I dont have write permission on the client but I need to show
the extracted data in the Notepad.
Please guide me in this direction.
Live Life King Size
Alomgir Miah
|
|
|
|
|
You can do it using the windows API. I don't remember exactly, but you use FindWindow I think, with some paramter like SET_TEXT or something. There's an example that does exactly what you want somewhere on pinvoke.net[^]
/\ |_ E X E GG
|
|
|
|
|
Thanks a lot for your reply.
Private Declare Ansi Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Int32, ByVal hWnd2 As Int32, ByVal lpsz1 As String, ByVal lpsz2 As String) As Int32
Private Const WM_SETTEXT As Integer = &HC
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim hwnd As Integer = FindWindow(vbNullString, "Untitled - Notepad") '/// assuming you have notepad open.
Dim x As Integer = FindWindowEx(hwnd, 0, "Edit", vbNullString)
Dim strText As String = "some text"
If Not x = 0 Then
SendMessage(x, WM_SETTEXT, 256, strText)
End If
End Sub
Live Life King Size
Alomgir Miah
|
|
|
|
|
cool, you found it. GOOD JOB!
/\ |_ E X E GG
|
|
|
|
|
I have a .Net Win form which has a) main menu, b) tree control, c) a custom control to display details of the selected TreeNode
-----------------------------
MainMenu:
mnuDelete -> [del]
mnuCopy -> [ctrl+c]
mnuCut -> [ctrl+x]
mnuPaste -> [ctrl+v]
Tree Control: is the standard .Net treeview with HideSelection = false. (So the selected node is always highlighted even if the input focus is moved to another control)
Detail view Custom Control: Contains few textboxes
The problem I'm having is that when I'm on detail view, and making changes in the textbox, I press CTRL + [C, X, V] or Delete keys on the keyboard, but the key is captured by the main menu, and which trigger an event for {menu_name}_click(...). I do not want this event to be fired but want it to be handled by the textbox control.
Any suggestions would be greatly appreciated.
Thanks.
- Malhar
|
|
|
|
|