Hey guys,
I have downloaded vb express 2005 and I am having some problems.
I converted one of my vb6 programs and after a few changes I got it to mostly work (couple of problems).
1. When I run the program (IDE or compiled) the button shows up in the task bar and if down, as it should be, but the form is not showing. By pressing the button to minimize it and again to restore it then it shows. I have tried the Me.Show() but that doesn't work. Also ending the program the form goes away but the button is still there. Pressing it to minimize it and pressing it to restore it the form comes back. I tried using Application.Exit() but does no good.
2. I have an image that shows in the design window but when the program is run it is not showing. It must be something simple but I can't figure it out.
I have programed with vb since version 1 but I think I have my work cut out for me in vb net.
Thanks in avdance for any help,
Wayne

blindreaper666

08-25-2004, 07:13 PM

Hey guys,
I have downloaded vb express 2005 and I am having some problems.
I converted one of my vb6 programs and after a few changes I got it to mostly work (couple of problems).
1. When I run the program (IDE or compiled) the button shows up in the task bar and if down, as it should be, but the form is not showing. By pressing the button to minimize it and again to restore it then it shows. I have tried the Me.Show() but that doesn't work. Also ending the program the form goes away but the button is still there. Pressing it to minimize it and pressing it to restore it the form comes back. I tried using Application.Exit() but does no good.
2. I have an image that shows in the design window but when the program is run it is not showing. It must be something simple but I can't figure it out.
I have programed with vb since version 1 but I think I have my work cut out for me in vb net.
Thanks in avdance for any help,
Wayne

try me.showdialog() and me.close() but I haven't used any images in my programs, and I somewhat new to .net so I can't help with the image. Mabey if you post your source code, I can figure it out because It was also hard for me to convert from vb6 to .net but I got the hang of most of the little changes

Iceplug

08-25-2004, 07:19 PM

I would suggest you start by programming solely in .NET before trying to convert projects.
(And since there's no code, we can only guess)
Try adding a new "image" to the form in place of the old "image". Is that a picturebox?

waynespangler

08-25-2004, 08:01 PM

My code for ending the program:

Public Sub EndProgram()
Dim frm As System.Windows.Forms.Form
For Each frm In My.Application.OpenForms
frm.Close()
Next frm
Application.Exit()
End Sub

My form load is:

Private Sub frmMain_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Dim buffer As String
Me.Show()
Image1.Width = VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(Me.ClientRectangle.Width) - 2)
'check if new installation
If Dir(My.Application.CurrentDirectory & "\Leagues.dat") > "" Then
'if not then open the leaques data and get all league names
FileOpen(1, My.Application.CurrentDirectory & "\leagues.dat", OpenMode.Input)
While Not EOF(1)
buffer = LineInput(1)
If Trim(buffer) <> "" Then
Combo1.Items.Add(buffer)
End If
End While
FileClose()
End If
'ListCount is -1 so if not new installation then set the listcount to first item
If Combo1.Items.Count > 0 Then
Combo1.SelectedIndex = 0
End If
End Sub

In the past I have learned more by converting my old programs. I can see what changes have been made and change my mind set. I do plan on getting a book and surfing the internet for tutorials but I got the program and wanted to use it right away.
Thanks,
Wayne

Iceplug

08-25-2004, 08:15 PM

The tool doesn't convert the function calls to .NET standard.
For example:
Trim is not a .NET function but a VB backwards compatibility, and
Trim(S) is equivalent to S.Trim(), so there's not much need to use Trim()... similarly, I doubt you really need to convert pixels to twips and back.
FileOpen, LineInput, and FileClose are all VB backwards, and you have the StreamReader object which does the same thing except works for all .NET languages.

If you want to keep using the old VB functions, go right ahead. Just remember that they don't work in other .NET languages (it is depressing that they aren't automatically converted, though :( perhaps they don't want you to go to other languages )

Anyway :) what's the "image"? You still haven't said what it is.

waynespangler

08-25-2004, 08:37 PM

Thanks for your reply. I guess I have a lot to learn. I would have thought that the conversion would have put in the "modern" code.
I guess I use Image to include all pictures but it is listed in the properties as:
System.Windows.Forms.Picturebox.
In the properties:
SizeMode = StretchImage
Image = System.Drawing.Bitmap
InitalImage = System.Drawing.Bitmap
WaitOnLoad = True
Enabled = True
Visable = True
Locked = True
Modifiers = Friend
Anchor = Top Left
AutoRelocate = True
Dock = Top

Those seem to me to be the ones that may be effecting it.
Thanks I do appreciate your time and patience.

Iceplug

08-25-2004, 08:41 PM

Have you tried putting a new picturebox on the form in its place?

waynespangler

08-25-2004, 08:53 PM

I deleted the old picturebox and put in a new one. I still doesn't show. I am using some api's to hide the title bar. It might have something to do with it. I am going to comment out that code and see if that is the problem.
Thanks

waynespangler

08-25-2004, 09:06 PM

It was the api code. Once I got rid of it then all went right. Prehaps you can help me on this. I need the title bar so that the info will show up on the task bar. I used the following code to hide the title bar.

'If I do away with the titlebar then nothing shows up on the task bar. I also don't have
'access to the minimize or restore buttons or the exit button(X). So I have to keep the
'titlebar but make it invisible.
'First make sure the form is not being minimized otherwise we get an error
If WindowState = System.Windows.Forms.FormWindowState.Minimized Then
FormShow = True
frmLeague.Visible = False
Exit Sub
End If
'Find the border width which is the difference of the width and the scalewidth divided by 2. P.S. this I had to change due to .NET Border = (VB6.PixelsToTwipsX(Me.Width) - VB6.PixelsToTwipsX(Me.ClientRectangle.Width)) / 2
'Now to get the title bar height subtract the scaleheight and the border from the heightB] P.S. this I had to change due to .NET[/B]
TitleHeight = VB6.PixelsToTwipsY(Me.Height) - VB6.PixelsToTwipsY(Me.ClientRectangle.Height) - Border
'Convert the title height to pixels and subtract the border from the title bar heightB] P.S. this I had to change due to .NET[/B]
TitleHeight = TitleHeight - Border
'********************************************************************* *****************************
'THE FOLLOWING CODE WAS PICKED UP FROM THE INTERNET AND IS MOSTLY
'NOT MINE. I FORGOT WHERE IT CAME FROM.
'********************************************************************* ******************************
wid = VB6.PixelsToTwipsX(Width)
hgt = VB6.PixelsToTwipsY(Height)
'Create the outer region which is the full form
outer_rgn = CreateRectRgn(0, 0, wid, hgt)
'Create the inter region which is the title bar
inner_rgn = CreateRectRgn(0, 0, wid, TitleHeight)
'Create a blank region and combine the two regions subtracting the inter from the outer
combined_rgn = CreateRectRgn(0, 0, 0, 0)
CombineRgn(combined_rgn, outer_rgn, inner_rgn, RGN_DIFF)
'Now set the window to the new display
SetWindowRgn(Handle.ToInt32, combined_rgn, True)
'Delete all the regions created
DeleteObject(combined_rgn)
DeleteObject(inner_rgn)
DeleteObject(outer_rgn)
Is there a better way to do this?
Thank You,