|
VB.NET is not a replica of C#. There are differences, and some things that are possible in C# are not possible in VB.NET. The reverse may also be true, although I doubt it.
However, in this case there is no problem...it does not matter that the second one is named getEnumerator1 . When used through the interface, it will still be called getEnumerator .
my blog
|
|
|
|
|
Helo, I have application that using a server and client architecture. The application in the local machine is connected to the database in the server. The database has a table that store the path of the images. The path of the image is the path that exist in the server. If the application want to display the image from the local machine, it will try to get the path of the image. What I want to ask are:
- Does the application take the image first then transfer to local machine, or it just pass the path of the image to the local machine? If it just pass the path, I think it will raise an error, since the image is not exist in the local machine.
- How to cover the error?
- Or how to solve it in order the local machine can display the image from the path that exist in the server?
Learning .NET
|
|
|
|
|
your problem is having the following the solution.
You should get the network path of the image file, no matter from which machine you are accessing the image.
If you are using the FileSystemObject it returns you the network path of a file. This path should be stored into the database server. So, while accessing images from your database it returns u the network path of the image.
|
|
|
|
|
1. Ooh, i have said wrong thing before. Sorry. The image path is in another client computer. The server just function as a database server. The image path is saved to database server from another client. Thus, the image is in that client computer. Does it affect anything to what I have said before?
2. Is the network path same with the shared folder?
I usually store the path, like "C:\MyApp\Image\" to the database. How can I store the network path of the path in the client computer to the database?
3. I am using OpenFileDialog to retrieve my image, is the OpenFileDialog the same with the FileSystemObject? If not the same, how should I use the FileSystemObject?
Thanks for your help.
Sorry for having my bad English.
Learning .NET
|
|
|
|
|
Hi,
Actually, you'll need to create a shared on the server and store an UNC path (that is, \\SERVER\SHARE\file.jpg") in the server database. That should solve the problem.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Hi,
I have a combobox, for users. It's a lookup, which gets the user names from the table "tblContacts" field "Name".
when the form loads, the combobox gets populated. There is also one button to add the user, if the user is not available in the table, and onClick the Add button, which will pop-up one more form, to add the new user. it does fine, adds the user to the table. but it dosen't populate the combobox immediately with the new user just added.
when the form loads, i was storing all the values in an Arraylist from the table and specifying the combobox datasource as the Arraylist.
can anyone tell me how to dynamically bind the combobox, which will reflect the new records added.
Thanx
vijay
|
|
|
|
|
That's is because you combo box's data source is set to ArrayList that is not updated when you add new user. The new user is added to the table without syncronizing the ArrayList. Try to replace all the values in the ArrrayList with the table when there is new user added.
I am not expert. I am just a beginner. Learning .NET
|
|
|
|
|
I have just started with VB.NET and was wondering how do i get things like windows version, ip of my machine, cpu and memory information.
I want to get them and display it in a label/textbox.
thx
|
|
|
|
|
I am not sure it works in .Net but here is how to
do it in vb. I just found this, so you have to find
a way to be compilable.
Thanks,
Shin
Option Explicit
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Private Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
Private Declare Sub GetSystemInfo Lib "kernel32" ( _
lpSystemInfo As SYSTEM_INFO)
Private Declare Sub GlobalMemoryStatus Lib "kernel32" ( _
lpBuffer As MEMORYSTATUS)
Private Sub Form_Load()
Dim Sys As SYSTEM_INFO
Dim tMem As MEMORYSTATUS
GetSystemInfo Sys
GlobalMemoryStatus tMem
Debug.Print "Percentage of memory currently in use : " & Format(1 -
(tMem.dwAvailPhys / tMem.dwTotalPhys), "00.00 %")
Debug.Print "Total Available : " & Format(tMem.dwAvailPhys, "### ###
###")
Debug.Print "Total Physical : " & Format(tMem.dwTotalPhys, "### ### ###")
Debug.Print "Total Virtual : " & Format(tMem.dwTotalVirtual, "### ### ###
###")
Debug.Print "Processor Type : " & Sys.dwProcessorType
Debug.Print "Number of Processor(s) : " & Sys.dwNumberOrfProcessors
End Sub
|
|
|
|
|
thx...
lets see if this works...
|
|
|
|
|
The other example code that was posted should work, but it's easier to do with the System.Management namespace. If your just learning VB.NET, and have no other programming experience, it can be very confusing to use though. There are no articles on CodePorject in VB.NET, but there are in C#. Try this[^] for a list of articles.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am working on the outlook addin.
Dim otlkDoc as Outlook.application
Dim otlEmail As Outlook.MailItem
otlEmail = otlkDoc.Application.CreateItemFromTemplate("c:\abc.msg")
seems like this function CreateItemFromTemplate doesn't work for .msg file?
what i want to do is to load .msg file from local pc and add it into the outlook inbox.
anyone can help?
Shinya
|
|
|
|
|
Is there anyone who can help me to find a way to capture/handle the pressing of the arrow-keys in a VB-application. I have set the KeyPreview property of my form to TRUE but the effect of pressing arrow-keys is the focus-changing and not the execution of KeyDown-procedure . Thanks!
|
|
|
|
|
Hi, I found this might help you. In vb6 create a text box and go to event KeyDown. See the following code then you will get some idea from it.
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)<br />
<br />
MsgBox KeyCode<br />
<br />
End Sub
Roath Kanel
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
I have some buttons in my form, so I had to make a roundabout way to solve the problem with the capturing of the arrow keys. First, I created a text box and place it behind a button (so the text box isn't visible but has the focus!); and second - I set the TabIndex property of the text box to 0, so when I press an arrow key, the KeyDown event of the text box will be executed (not the changing of the focus).
I wonder why in VB there isn't a way/property to turn off the focus changing when an arrow key is pressed, so the programmer can capture this event directly (by analogy with the TabStop property).
Thanks for the idea, Roath
|
|
|
|
|
Why you have to put textbox behind the command button? If you want to move from the first command to the other command button just set Tab Order property of each command button. We don't need to use text box behind the command button and it is very easy that you do not need to write the code.
Anyway, my name is Kanel not Roath. (Cambodia use Family name then First name style).
Roath Kanel
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
My New User form has a pair of text boxes used to define new users to my app. For both I've used the 'Leave' event to validate them before the form's OK button is enabled. (I've included the code for the simpler one of the two below.) I also want a Cancel button so that the user can choose not to set up a new user. At the mo, the Cancel button just sets DialogResult.Cancel.
When the user clicks on the Cancel button the first time, the Leave event is still triggered and the users gets a "You must enter a name." message box. If the user clicks Cancel again, the window closes.
I realise that I could do the checks when the user clicks OK but it seems 'more OO' to validate each box. How can I avoid this message box on cancel but still check the formatting when the user moves out of the text box otherwise?
Private Sub txtNewOppName_Leave(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles txtNewOppName.Leave
If txtNewOppName.Text = "" Then
Me.NameDefined = False
MessageBox.Show("You must enter a name.")
Me.Select()
Else
Me.NameDefined = True
End If
If Me.EmailDefined And Me.NameDefined Then
Me.btnOk.Enabled = True
End If
End Sub
|
|
|
|
|
How do I set a reference to the Microsof.Win32 Namespace? I've been looking for it both in the Add Reference List and in the GAC and I haven't found it. Where?
|
|
|
|
|
I'm a newbie so maybe this is a daft question but why do you need to? If you just put
Imports Microsoft.Win32
at the top of your class, does that do the trick?
|
|
|
|
|
How to get the target path of shortcut files(.lnk)?
|
|
|
|
|
I'm trying to read text and maybe pixels from a windows application. The application has list boxes and a text box. I tried an example i found using WM_GETTEXT, which works for some applications like Notepad (textbox Edit), and the windows calculator, but when I probed for the class name of the progam i'm trying to read from, it says #32770, and the same WM_GETTEXT trick doesn't work.
Does anyone have advice for what I should try?
|
|
|
|
|
I used spy++ to find out that the text I want is sent through messages like this:
EM_REPLACESEL lpszReplace:0012f050("Text I want to scrape")
|
|
|
|
|
I made a little application that grabs random pixels from a scanned photo and figures out the R, G, & B values of that pixel. Then it's supposed to trasfer those values found into one of three other PictureBox controls. one for red, one for green and one for blue. I used this formula:
lColor = picPhoto.Point(x,y)<br />
iRed = lColor Mod 256<br />
iGrn = lColor \ 256 Mod 256<br />
iBlu = lColor \ 65536 Mod 256<br />
<br />
picRed.pset (x,y),RGB(iRed,iRed,iRed)<br />
picGrn.pset (x,y),RGB(iGrn,iGrn,iGrn)<br />
picBlu.pset (x,y),RGB(iBlu,iBlu,iBlu)
The Mysterious problem is that only the blue channel is doing what it's supposed to, producing a nice greyscale rendering of the blue channel pixels in question. The other two just produce noise. I can't figure out why. I checked and double checked all the properties of the PictureBox controls, and they're exactly the same. I also double checked the formula for separating the iRed, iGrn, and iBlu factors from the lColor value.
Any thoughts? Try it for yourself, see if you can get it to work. What am i doing wrong?
----------------------------------
Okay. I figured it out. The problem was the computation of the x,y coordinates for the red and green windows. It was computing the right colors, but it was putting them in the wrong places. It works now. Thanks.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|
Your math is a little off. Here's a working example:
Private Sub mnuSplit_Click()
Dim x, y As Long
Dim RGBColor As Long
Dim R, G, B As Long
Debug.Print "Image Height: " & pctSource.Height
Debug.Print "Image Width : " & pctSource.Width
For y = 0 To pctSource.Height
For x = 0 To pctSource.Width
RGBColor = pctSource.Point(x, y)
R = GetRGB(RGBColor, 1)
G = GetRGB(RGBColor, 2)
B = GetRGB(RGBColor, 3)
pctRed.PSet (x, y), R
pctGreen.PSet (x, y), G * 256
pctBlue.PSet (x, y), B * 65536
DoEvents
Next
Next
End Sub
Function GetRGB(RGBval As Long, Num As Integer) As Integer
' Pass in Num = 1 to return the Red value, 2 for Green, and 3 for Blue
GetRGB = RGBval \ 256 ^ (Num - 1) And 255
End Function
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Nope. That didn't do it. The problem is somewhere else. I applied your code to it and it's doing the exact same thing.
I'm pretty sure your math formula and mine are outputting the same results. I'll try stepping through it yet again to see if I can find the solution that way.
Thanks for your help, and let me know if you think of anything else.
"Go to, I’ll no more on’t; it hath made me mad." - Hamlet
|
|
|
|
|