|
|
|
Hi,
Thanks for that Progload, I'll have a read, it looks a bit over my head, it may take some time.
With regard to cross posting, no problem at all, I will reword in future if posts are relevant to more than one forum.
I just dont like smart ass, sarcastic replies,
Rgds
Ironstrike
|
|
|
|
|
ironstrike1,
Yes I can understand that, But..it is considered rude here to cross post...
It's mentioned somewhere here every day here.
Most all of us, read all the posts in most of the fourms and we all can see all of the posts from the Latest Comments Page:
http://www.codeproject.com/script/comments/all_comments.asp[^]
So if someone is really interesed in responding they will... no matter what fourm it's in.
Regards,
progload
|
|
|
|
|
I Didnt realise that,
Thanks for the tip
Rgds
Ironstrike
|
|
|
|
|
You are the only person being a wise ass in this thread... it is a sure fire way to get your questions NOT answered.
Crossposting is considered rude on 100% of all online forums I have ever visited, take some time to get to know a place before you start calling people out.
Oh, and FYI I never removed your thread from, nor restored it to, this forum.
PS> You can guarantee I will not be answering any of your future questions.
How to get answers to your questions!! Read it[^]
|
|
|
|
|
|
Congrats, this was your first post at this forum and you managed to piss off more than a few regulars.
Plus, thanks for the email calling me an "english twat"... really need abusive emails from f***ing idiots after a piss poor day at work.
|
|
|
|
|
Dont forget tell that I sent you a friendly email and was told to sod off.
If thats the way you deal with people I am not surprised you had a bad day at work.
|
|
|
|
|
Welcome to code project. If I was you, I'd register a new account, and pretend this whole mess never happened.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Lol, Yes, not the perfect start but hey, you cant get on with everybody. I have also encountered a lot of friendly people like yourself
Thanks for the welcome
-- modified at 19:46 Thursday 23rd February, 2006
|
|
|
|
|
Hi,
I've written a VB.NET application that's a front-end interface for an Access database. The application works fine except for one small anomaly.
The first form that loads up is a small login dialog box (username, password, OK, etc.). It's WindowState is set to 'Normal' and it's StartupLocation is set to 'CenterScreen'.
After installing the application and logging in for the first time nothing unexpected happens. But with all subsequent log-ins the login dialog box is maximized over the whole screen (including the taskbar). This does not happen when debugging the application in the IDE. It only happens when the application is installed.
Can anyone help?
Thanks in advance.
QC
|
|
|
|
|
specify the dimensions / coordiantes of the login window
Divya Rathi
|
|
|
|
|
Hi Divya, thanks for replying.
Form.Width = 256
Form.Height = 134
Form.Left = 0
Form.Top = 0
Form.StartPosition = CenterScreen
Form.WindowState = Normal
Form.TopMost = False
Thanks.
QC
|
|
|
|
|
The following code works on my PC but when I try and run the exe on another PC I get the following message....
An unhandled exception has occurred in your application.....
File or assembly name Interop.Excel, or one of it's dependencies, was not found.
I added reference Microsoft Excel 8.0 Object Library
Here is my code....
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyExcel As New Excel.Application
'Creating Excel Worksheet
Dim WSheet As New Excel.Worksheet
'Adding new worksheet to excel workbooks
WSheet = MyExcel.Workbooks.Add.Worksheets.Add
'Writing values in Work Sheet
With WSheet
'Cells(row, column)
.Cells(1, 1).Value = "TESTING "
.Cells(2, 1).Value = "A"
.Cells(2, 2).Value = "B"
.Cells(2, 3).Value = "C"
.Cells(2, 4).Value = "D"
End With
'Saving .xls file with Test.xls name
WSheet.SaveAs("C:\temp\aTEST.XLS")
End Sub
|
|
|
|
|
check if Excel 8.0 is installed on that m/c or some other previos verson is installed
Divya Rathi
|
|
|
|
|
i able to pass around the image val from form 2 to form 1 ,
but wats wrong when i want to pass it again from form1 to form3???
i try to add again with those coding but i cant run the program ,it keep on running until my computer hang.. so have to stop the program manually. I guess the program having the unfinished loop after i add the coding. I not sure able to put the form2 and form1 image handling together or not, but thats where the infinite loop comes out. such as
Form1:
Public Event NewImage(ByVal i As Image)
If Label2.Text = 1 Then
RaiseEvent NewImage(picturebox(x).Image).....
Private Sub opentokengalery()
AddHandler token.NewImage, AddressOf newimagehandler
End Sub
Public Sub newimagehandler(ByVal i As Image)
PictureBox1.Image = i
End Sub
-- modified at 7:36 Friday 24th February, 2006
|
|
|
|
|
hellow to all ..
is there a way to update a datagird , with out loading all the query agine ?
because when i load the query agine i lose the sorting that i had made on the datagrid ..
anyhelp appreciated ...
thxx
|
|
|
|
|
The form is 510 by 360. One half of it has to go from black to green. The other Half from blue to black. I think you're supposed to create a loop of some sort to change each line using the pen. But How?? Remember I am only a beginner so, i know only the basics of VB.net.
E-mail me at tate_thomasster@gmail.com and i can give you the source code to see if you can point out my mistakes.
If you are familar with the Thomson Course Technology book, Visual Basic.Net:
An object-oriented approach, then it is Chapter 6, Exercise 2. This is my first time working with Vb.Net.
Ty
|
|
|
|
|
Okay. From the e-mail you sent me, you want to split your form into 2 triangles. In the top left corner, you want a triangle with a color gradient from black to green. In the bottom right corner, you want a triangle with a color gradient blue to black.
What you need is a GradientBrush to draw this for you. You'll also need to catch your form's Paint event so that you can draw these triangle onto your form. The drawing is done on the Paint method's passed in Graphics object.
The code should look something like this.
Private Sub MyForm_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles MyBase.Paint
Dim brGradient As System.Drawing.Drawing2D.LinearGradientBrush
Dim points() As PointF
'
' Validate.
If (e Is Nothing) Then Return
If (e.Graphics Is Nothing) Then Return
'
' Get form's client size.
Dim clientRectangle As New System.Drawing.Rectangle(0, 0, _
Me.ClientSize.Width, Me.ClientSize.Height)
'
' Draw the green gradient triangle.
brGradient = New System.Drawing.Drawing2D.LinearGradientBrush(clientRectangle, _
Color.Black, Color.LightGreen, _
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)
points = New PointF() {New PointF(0, 0), _
New PointF(clientRectangle.Width, 0), _
New PointF(0, clientRectangle.Height)}
e.Graphics.FillPolygon(brGradient, points)
brGradient.Dispose()
'
' Draw the blue gradient triangle.
brGradient = New System.Drawing.Drawing2D.LinearGradientBrush(clientRectangle, _
Color.Blue, Color.Black, _
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)
points = New PointF() {New PointF(0, clientRectangle.Height), _
New PointF(clientRectangle.Width, 0), _
New PointF(clientRectangle.Width, clientRectangle.Height)}
e.Graphics.FillPolygon(brGradient, points)
brGradient.Dispose()
End Sub
|
|
|
|
|
Okay so I sort of understand. But the way I was trying to do it was create a line that draws the color in a loop repeatedly until it changes to the other color. Like creating three different varaibles and incremeting the green variable from 0 to 255. Is that a good way of doing it?? Here's some of the code(I haven't quite yet created the loop)...
Private Sub frmSplash_Paint(ByVal sender As Object, ByVal e As _ System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim graCurrent As Graphics = e.Graphics
Dim recCurrent As Rectangle, colCurrent As Color
Dim sbCurrent As SolidBrush, penCurrent As Pen
Dim intHeight As Integer, intWidth As Integer
recCurrent = New Rectangle(0, 0, Me.Width, Me.Height)
sbCurrent = New SolidBrush(Color.Green)
graCurrent.FillRectangle(sbCurrent, recCurrent)
Dim CounterLoop As Integer = 1
intHeight = 0
For intwidth = 0 To Me.Width Step _
ToInt32(Me.Width / 255)
penCurrent = New Pen(Color.FromArgb(0, 0, 0, 0))
Select Case CounterLoop
Case 1
colCurrent = Color.FromArgb(0, 0, 0, 0)
CounterLoop += 1
Case 2
colCurrent = Color.FromArgb(0, 0, 1, 0)
CounterLoop += 1
Case 3
colCurrent = Color.FromArgb(0, 0, 2, 0)
CounterLoop += 1
Case 4
colCurrent = Color.FromArgb(0, 0, 3, 0)
CounterLoop += 1
Case 5
colCurrent = Color.FromArgb(0, 0, 4, 0)
CounterLoop += 1
Case 6
colCurrent = Color.FromArgb(0, 0, 5, 0)
CounterLoop += 1
Case 7
colCurrent = Color.FromArgb(0, 0, 6, 0)
CounterLoop += 1
Case 8
colCurrent = Color.FromArgb(0, 0, 7, 0)
CounterLoop += 1
Case 9
colCurrent = Color.FromArgb(0, 0, 8, 0)
CounterLoop += 1
Case 10
colCurrent = Color.FromArgb(0, 0, 10, 0)
CounterLoop += 1
End Select
graCurrent.DrawLine(penCurrent, 0, ToInt32(Me.Height / 180), _
ToInt32(Me.Width / 255), 0)
Next
End Sub
End Class
Ty
-- modified at 10:04 Friday 24th February, 2006
|
|
|
|
|
You can draw the gradient yourself with individual lines. It just takes more effort (and might not be as efficient). GDI+ can do the work for you with a single Gradient brush, like in the code I gave you.
Your code isn't going to work though. For one thing, you're assigning a new Color to "colCurrent" on every pass in the loop, but you never assigned the color to your pen. You should be creating the pen with this color at the bottom of your switch statement.
penCurrent = New Pen(colCurrent)
Also, you really shouldn't be using a switch statement. There are a lot of colors for you to go through, which would involve too many case statements. Instead, you should create red, green, and blue integer variables and increment the ones you need on every pass. Luckily you're transitioning from black to another color, which involves just incrementing up from (0,0,0). If your starting color was not black, then creating a gradient would be much, much harder.
Also, you need to call your brush's and pen's Dispose() method when you're done using them. Otherwise you'll have GDI leaks. As a general rule, any object that you've created should be disposed if it has a Dispose() method. That means disposing the pen before overwriting it with a new one on every pass in the loop.
|
|
|
|
|
Here's a follow up to drawing a gradient with individual lines...
First you need to figure out how to calculate the gradient. The next pen color that you calculate within your loop is determined based on your x position in the form. For the first triangle, we should convert those x coordinates into green color percentages, where the left most x on the form is 0% (black) and the right most x on the form is 100% (green).
Dim percentGreen As Double = x / Me.ClientSize.Width
Next, we convert that into a color value which ranges between 0 and 255.
Dim greenValue As Integer = percentGreen * 255
Simple math so far. Now since we're drawing a triangle, we're going to need to use trigonometry to calculate the y. We're going to iterate the x from left to right, and draw a line top to bottom, but that bottom is going to get shorter and shorter on every pass of the loop. The width of the triangle from x to the right most point will be...
Dim width As Double = Me.ClientSize.Width - x
We need to calculate the angle of the right most point on the triangle. This is a constant value. You only need to calculate this once.
' Tangent(Angle) = Opposite / Adjacent<br />
' Angle = ArcTangent(Opposite / Adjacent)<br />
' This angle is in radians!<br />
Dim angle As Double = Math.Atan(Me.ClientSize.Height / x)
Now that you have the width and angle, you can calculate the height.
' Opposite is the y, which the part we want.<br />
' Tangent(Angle) = Opposite / Adjacent<br />
' Opposite = Tangent(Angle) / Adjacent<br />
Dim y As Double = Math.Tan(angle) / x
So, all in all, it should look something like this. I'll leave the rest to you.
' This is the loop for the green triangle.
For x As Integer = 0 To (Me.ClientSize.Width - 1) Step 1
' Calculate green value here.
' Create pen here using calculated color value.
' Calculate x and y here.
' Draw line here via e.Graphics.DrawLine().
' Dispose pen here.
Next
|
|
|
|
|
Thank You for helping me. And a last request if you don't mind. Here is the final code to the splash screen. Just look over it and see if i got the general idea right.
Private Sub frmSplash_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim graCurrent As Graphics = e.Graphics
Dim colCurrent As Color, colCurrent1 As Color
Dim penCurrent As Pen, penCurrent1 As Pen
Dim LineLoop As Integer, LineLoop1 As Integer
'Sets the first coordiante for the green triangle.
Dim Greenx1 As Integer = 0
Dim Greenx2 As Integer = 0
Dim Greeny1 As Integer = 0
Dim Greeny2 As Integer = Me.Height
'Sets the first coordiante for the blue triangle.
Dim Bluex1 As Integer = Me.Width
Dim Bluex2 As Integer = 0
Dim Bluey1 As Integer = Me.Height
Dim Bluey2 As Integer = 0
' Sets the "step value" or how far up and over for each line created.
Dim StepX As Integer = ToInt32(Me.Width / 255)
Dim StepY As Integer = ToInt32(Me.Height / 255)
' Darwing of the Green Triangle
For LineLoop = 0 To 255
colCurrent = Color.FromArgb(0, LineLoop, 0)
penCurrent = New Pen(colCurrent, 4)
graCurrent.DrawLine(penCurrent, Greenx1, Greeny1, Greenx2, Greeny2)
Greenx1 = Greenx1 + ToInt32(StepX)
Greeny1 = Greeny1 + ToInt32(StepY)
Greenx1 += 1
Greeny1 += 1
Greeny2 += 1
Next LineLoop
' Drawing of the Blue Triangle
For LineLoop1 = 255 To 0 Step -1
colCurrent1 = Color.FromArgb(0, 0, LineLoop1)
penCurrent1 = New Pen(colCurrent1, 4)
graCurrent.DrawLine(penCurrent1, Bluex1, Bluey1, Bluex2, Bluey2)
Bluex1 = Bluex1 + ToInt32(StepX)
Bluey1 = Bluey1 + ToInt32(StepY)
Bluey1 -= 1
Bluey2 -= 1
Bluex2 += 1
Next LineLoop1
End Sub
Ty
|
|
|
|
|
It's pretty close. It doesn't quite draw corner to corner on my form. And there is a slight white gap between the 2 triangles. My form is a different size than yours. But it is really close. Good job so far.
Two things...
1) I had a compile error on your ToInt32() calls. I had to change them to Convert.ToInt32().
2) You need to Dispose your pens at every pass of your loop. Both loops really. Do it like this...
penCurrent.Dispose
Next LineLoop
|
|
|
|
|