|
Hi:
There is one parent form and several form mdichildren. In each child form there may be one to many controls. Information in one control is associated with other controls which may be in the same child form or in different forms.
The question is how to notify other controls if one control content is changed. What design policy (e.g. using design patterns such as Observer,or others) is appropriate ? Is there any sample I can refer to? Thanks.
David
abc
|
|
|
|
|
Your requirement is little unique so the solution would be unique too. I have one suggestion there might be many from others. well do the following
1. Build One Function on every Form with these parameters
public Function ControlAlert(FormName,Controlname,Value,any other parameter if required)
''' do here what you want to do if any other control has changed value
end function
2. on change of all the controls lying on all the forms. call one function which you will be created in your Global Module say
public sub ControlValuechanged(FormName,ControlName,ControlText)
' Over here you will get the reference of all the forms by using MDIForm Child loop and will pass the parameters to those forms in function
ControlAlert which you created on Step 1 like this
Dim frm As Object
For Each frm In MDIMain.MdiChildren
frm.ControlAlert(parameters)
Next
end sub
Rizwan Bashir
|
|
|
|
|
Your solution sounds viable. Yet I learned there are some design policies/patterns that can provide more elegant way to deal with that issue. I'll use your solution and explore design patterns as well.
Any advice besides the solution above is appreciated.
David
abc
|
|
|
|
|
i have a problem on merging 2 lists with 5 inputs on each list. the five inputs were already sorted and i'm trying to have a function to merge it. this is my defining function:
void merge(numA[],numB[],numAB[])
{
}
how can i merge the inputs in numA[] and numB[] and put them in the array of numAB[]?
|
|
|
|
|
Have a look at the Array.CopyTo method. If the final array also needs to be sorted than just make another call to Array.Sort to sort it afterwards.
|
|
|
|
|
Hi. I have a general question about custom controls. I want to make a control on a windows form that has a nonrectangular shape and the control itself is divided into several nonrectangular shapes. I need to divide the control because i want the different areas in it to have different properties.
I'd be very grateful if someone gives me a general advice on how to achieve that. I've already tried with transparent labels over a picture representing the control, but it is not nearly as good as i need it to be.
Thank you in advance.
|
|
|
|
|
A possible cheat/workaround...
Depending on how graphic you want your controls to be here's an idea (untested - something I've thought of doing but never got around to).
1. Draw your custom control in Flash (I choose Flash coz it's simple and powerful),
2. Add a Shockwave Flash object to your toolbox.
3. Create a new custom control, adding the Flash object to it.
4. Give the control applicable events like onClick, onMouseEnter/Leave, etc.
5. Use GDI+ to cut out the unwanted square bits around your control (using GDI+ available here[^]).
6. Build and test.
As mentioned earlier, I have yet to try this myself so I'm not completely sure that it'll work tho I don't see why it shouldn't given a little elbow grease. The choice of doing it this way is yours, you take my advice at your own peril
Good luck, if you get it to work please let me know - i'd be very interested to see.
|
|
|
|
|
Thank you for the reply. I am not used to using any of the macromedia products but here's a good reason to try them out As soon as I finish the control i will write you back.
Thanks once again.
|
|
|
|
|
Hello,
I'we been looking for tutorials about how to create buttons that reacts mouse events in Direct3D application. So basicly I just want to create a normal button but later on I need to make different shaped buttons, like triangle and round.
I understand the basic consept behind the buttons, but I can't figure out how to calculate the coordinates when the mouse is over buttonarea. Basicly only thing that should be somehow calculated is that where are the coordinates that are on button are. I was thinking to draw the buttons with vertixes, but the buttons are invisible for the user, because the buttons only work as a hit points and they register that if user presses the mousebutton over them.
Any idea where I could find tutorials for these?
|
|
|
|
|
How can I extract an embedded or attached file (say MSWORD, MSEXCEL, or PDF) inside PDF and save it programmatically, using VB.NET. I can see that you can walk through different annotations in a page but how can you determine the presence of attached file and open it and saving it programmatically.
any suggestions????
|
|
|
|
|
add handler to this procedure at the end like
Private Sub Combo1_Change() handles combo1.change
Rizwan Bashir
|
|
|
|
|
' this one is the normal generated code when you double click on the combo in design mode. and put your calculation in here
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
End Sub
Rizwan Bashir
|
|
|
|
|
you probably need to put that code in the Click event instead of the Change event.
hth
|
|
|
|
|
Hi.
Im trying desperatly to print the contents from a mdi children form, which has the look of an excel worksheet. I have a subroutine that via gdi+ creates a bitmap om the viewable part of the form. But I need to print even the part that you have to scroll to see.
It seems that is impossible to use BitBlt for this purpose, since BitBlt only can draw the viewable part. Right? If so, what should I then do? It must be possible to print? Im quite frustrated here, since it must be possible to print event the parts that aren´t in view.
If BitBlt doesnt work, can I put each control(textboxes, panels, etc) on the printdocument manually?
|
|
|
|
|
Form.PrintForm doesnt work?
|
|
|
|
|
Take a look at the message I posted in the SQL forum. Please be kind and do not cross post
|
|
|
|
|
Now im a bit confused here. SQL-forum?
|
|
|
|
|
I need to programmatically search through email messages for a set of users on our Exchange server and make a report of and forward messages that have not been opened. Does the Exchange SDK allow this kind of programmatic access or is there a better solution? All the information I can find on the SDK is very vague.
Thanks.
-- modified at 9:35 Friday 21st July, 2006
|
|
|
|
|
Hello All,
I am developing an application using VB 2005 that will run continuously in the background on a users workstation. This application will automatically transfer files from the local machine to a remote server and vise versa. It checks for the files on a timed interval. I have two problems with this application that I am having trouble figuring out:
The first problem is that the cmd.exe shell pops up on the screen every time it maps the drive. The application needs to be completely 'invisible' to the user. I cannot have something popping up every several minutes while they are trying to work.
The second issue is that I do not want to let a continuous connection to the remote server so I have mapped a network drive to the remote server using process.start. I have provided administrative credentials when creating the drive. Local users do not have permission to connect to the remote server. Also, I only want to create the drive when necessary, and then close it when the current process is finished with it.
The drive mapping shows in My Computer when I check for it. However, when the code tries to access the drive to transfer the files, I get an error and the program shuts down.
The error is: system.unauthorizedaccess, eventtype: clr20r3.
I am assuming this has something to do with the user credentials, so I tried creating the mapped drive using the same command lines in my code using the command prompt. I was able to successfully create the mapped drive and access it under the local user account
Any ideas/help would greatly be appreciated.
This is the section of code that I am using to create the drive:
Try
srvConn = New System.Diagnostics.Process
srvConn.StartInfo.UseShellExecute = False
srvConn.StartInfo.RedirectStandardError = True
srvConn.StartInfo.RedirectStandardOutput = True
srvConn.StartInfo.FileName = ("net.exe")
srvConn.StartInfo.Arguments = "use z: \\server\share" & " " & My.Settings.rbsSrvPwd & "/user:" & My.Settings.rbsSrvUsr
srvConn.Start()
srvConn.WaitForExit()
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
Microsoft.VisualBasic.FileIO.FileSystem.WriteAllText(My.Settings.logPoll, "Error: " & ex.Message & " occurred in rbsSrvConnection:rbsConnOpen" & vbCrLf, True)
End Try
mzak0420
|
|
|
|
|
Have a look at the forum message posted at this url:
http://www.codeproject.com/script/comments/forums.asp
Named "Accessing CD Drives"
You may be able to change the code to access network drives. Namely change the format to "DriveType.NetworkDrive" depending on your needs.
Also please not the last post on this message, This will work if u are trying to run .exe files if not, use the other method.
Posted by The ANZAC
|
|
|
|
|
The link to that thread is here.[^]
Dunno if that'll work tho... I saw the networked drive item in the enum but that code wasn't written with networked drives in mind...
|
|
|
|
|
Thank you for your suggestion and I appreciate it, however it did not work.
After some experimentation, I was able to get it to work. I am posting my solution in the event that it will help someone else. There were two things I was doing wrong:
1. I did not provide a redirect for the input. Seems you need to redirect error, input, and output even if you are not using the data.
2. I was using WaitForExit in the wrong context.
Here is the code that works:
info.StartInfo.FileName = ("net.exe")
info.StartInfo.UseShellExecute = False
info.StartInfo.RedirectStandardInput = True
info.StartInfo.RedirectStandardError = True
info.StartInfo.RedirectStandardOutput = True
info.StartInfo.CreateNoWindow = True
info.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
info.StartInfo.Arguments = "use z: \\server\share " & My.Settings.rbsSrvPwd & " /user:" & My.Settings.rbsSrvUsr
Process.Start(info.StartInfo)
If anyone sees any flaws please let me know.
mzak0420
|
|
|
|
|
I'm using VB.NET 2005 Express.
I have been working on a project that on startup populates a ListView with a total of 28 ListItems. Each one has a SmallIcon and LargeIcon (the SmallIcons are taken from 5 different gifs, whereas the LargeIcons are all unique). When I was using just a couple of dummy gifs to test other features, it was fast. Now it takes about 10-15 seconds to load the images into the respective ImageLists. How could it possibly take this long to load images? VB 6 was way faster and gave me the option of designating a different key for small and large icons, now (as far as I know) I have to use the same key for both and thus unnecessarily reload copies of the same image to the SmallIcon ImageList.
I've tried all sorts of things like BeginUpdate/EndUpdate, setting ListView.SortOrder = Nothing, delinking the ImageLists from the ListView and then relinking them, etc. to no avail. Why did they make such an easy control in VB 6 so much harder to use? Sorry if this problem has been dealt with here already.
Please help!
ccliam
|
|
|
|
|
Seriously, does anyone know a quick way to add images to an image list at runtime? Both Bitmap.FromFile() and Image.FromFile() seem to be equally slow, as is New Bitmap(). The gifs I'm adding are not large so I don't get what is taking so long.
Here's the specific code that's running so slow (it gets called within a For/Next loop):
iml16.Images.Add(Image.FromFile(strSmallFilename))
iml140.Images.Add(Image.FromFile(strLargeFilename))
I've hear AddRange is faster but I won't ever know how many images there will be to load so I don't see how I could create the array.
ccliam
-- modified at 11:40 Friday 21st July, 2006
|
|
|
|
|
What code do i need to copy a selected item from a list box to clipboard
so then i could paste it into any other program that accepts text
|
|
|
|