Program - Let The User Draw Lines - Error "NullReferenceExeption Was Unhandled"
May 3, 2010I'm trying to make a paint and im trying to make my program let the user draw lines
[Code]...
I'm trying to make a paint and im trying to make my program let the user draw lines
[Code]...
I am struggling with the code when I run it I get this error.
Dim CheckedItems(clbfiles.CheckedItems.Count) As Object
clbfiles.CheckedItems.CopyTo(CheckedItems, 0)
For Each CheckedItem As Object In CheckedItems
[code].....
I am currently using Visual Basic 2008 Express Edition.I want to make a program that will draw 700 random lines on it initially. I tried my code but the lines only appear in the same way such as straight line and diagonal line. Here's my code:
Public Class Form1
Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
[Code].....
I have a problem sending data to my access database.I get this error
NullReferenceExeption was Unhandled - "Object reference not set to an instance of an object."on this part of my codemaxrows = ds.Tables("asdf").Rows.Count What would that mean?Here is my code :
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
ID = TextID.Text
FName = Textfname.Text
LName = Textlname.Text
[Code]...
Error occuring at line: SqlDataSource3.UpdateParameters("TechID").DefaultValue() = CInt(technicianRow("TechID"))
Here is full VB code:
[code]....
I Was Coding A Tabbed Web Browser With A Progress Bar In Visual Basic 2010 Express Edition. I Started De-Bugging The Browser When It Pointed To This Sub: Private Sub Loading(ByVal sender As Object, ByVal e As Windows.Forms.WebBrowserProgressChangedEventArgs)
ToolStripProgressBar1.Maximum = e.MaximumProgress
ToolStripProgressBar1.Value = e.CurrentProgress
End Sub
And Showed This Error Message: ArgumentOutOfRangeException Was Unhandled By User Code Value of '-1' Is Not Valid For 'Value'. 'Value' Should Be Between 'Minimum' And 'Maximim'
What I have is a user control that has two RichTextBoxes. In the user control, there is RichTextBox1's TextChanged event, I want it to set RichTextBox2's Text to the same as RichTextBox1's Text, I'm currently using: RichTextBox2.Text = RichTextBox1.Text. The user control is on the main form, when I run the application and type I get this error: StackOverflowExecption was unhandled. [Code]
View 4 RepliesI'm making a program from witch one could run an application with different credentials.I can compile the program successfully, but when I press the button to run the program I get the following error: Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.The system cannot find the specified file.The code behind the button is as follows:
Dim myProcess As System.Diagnostics.Process = New System.Diagnostics.Process()
myProcess.StartInfo.FileName = "c:
un.bat /user:kreathyr c:getlogin.exe"
myProcess.Start()
Getlogin.exe does nothing but show the logged in username and run.bat utilizes the runas command.
I want to draw string in multiple lines and and I want to know how many lines given string will take. I am using following method.
[Code]...
I cannot seem to figure out why VB keep throwing me this exception but here is the code
[Code]...
I'm making the transition from VB6 to VB2008 and I'm having difficulty finding the equivalent to[code]...
It seems in VB2008 I can only use pens inside a picturebox1_onpaint() subroutine, I can't tell a picturebox what to do from a button_click subroutine or form_load subroutine first and then send the results to a picturebox. I have no control over when the graphics are drawn and from which subroutine. How do I solve this in VB2008 ?
I have a simple picturebox, line drawing procedure (call it "DrawTheLine"), which fires ok when I call it from a command button. But when I try to call it from the boot form_load procedure it doesn't work; no lines draw. No errors are raised.
Things I've thought of are:
1. The form_load procedure is not done creating all of the controls on the form, so it can't work with them yet. Doesn't make sense because my drawing call is the last thing in the form_load procedure, and it executes, but the picturebox does not show the lines.
2. Tried Application.DoEvents, but no go.
3. Tried using picturebox.invalidate to force a paint event and "called" the drawing procedure that way, with the appropriate arguments. Again, the procedure "DrawTheLine" fires, but no lines draw to the picturebox.
I have the following form:I want to join the boxes so that it looks like this: would rather create the lines on the userform manually but I do not think there is a way to do it. I've tried the following code but I cannot see the line:
Private Sub DrawLine(ByVal X_From As Integer, ByVal Y_From As Integer, ByVal X_To As Integer, ByVal Y_To As Integer, _
ByVal Line_Width As Integer, ByVal Line_Colour As System.Drawing.Color)
[code]....
Iam doing a sample project for school and i CHOSE Tic Tac toe. sample program of it becuase i have no idea where to start. And do I use a picture box to draw the lines?
View 1 RepliesI need to draw dashed lines. I use this code:
Dim MyPen As Pen = New Pen(Color.Black, MyWidth) With {.DashStyle = Drawing2D.DashStyle.Dash}
MyGraphics.DrawLines(MyPen , MyDots.ToArray)
But since the distance between successive lines it too short, the dashes start each one too near to the last. It causes a continuous black line
How would I do this? I want my Program to draw 2 lines in the center of the screen.
View 3 RepliesI can draw one line by mouse moving on a form, but i used cls function to clear screen when move mouse (otherwise it wont show single line when move mouse), so i cudnot draw next line with out clearing previously drawn line, kindly help how to solve this problm
[Code]...
I am making a drawing application (Graphics class), with a highlight pen and a calligraphy tool. But the pen tip should not rotate according to the line direction. I have tried the CustomLineCap, but still not working.
View 3 RepliesHow to draw lines inside the circle. I mean a circle with n-number of lines within in it.
View 7 RepliesFirstly I am using Vb 2008 Express Edition.I have the following code:
Code:
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e _
As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim x1 As Integer = 0
Dim x2 As Integer = 50
[code]....
When I run the above code it works , no problem. But I want to trigger it only on my Button_click event.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
I don't know how to call the PictureBox1_Paint into my Button1_Click
i want to "draw" zebra lines in my form [code] ican import background image, but I prefer code :)
View 1 RepliesThe image editor toolbar is not active. I would like to draw lines and shapes on a form.
View 1 RepliesI need to draw lines, in one VB form. Like paint, I need the tool brush, and design some lines and curves in a Vb form. How can I do this? I don't know where to start.
View 3 RepliesHow do I draw lines using DirectX? (on my form)
View 1 RepliesI'm trying to draw a grid using vertical and horizontal lines.Both For..To statements work fine when one of them is commented out otherwise, they won't work together. At run, only the first For..To statement is executed.[code]
View 6 RepliesI have some lines drawn in many different directions (2D y 3D enviroments). Is there any way to draw text oriented along the direction of each of these lines? It was an easy task in former versions of Visual Basic, but now it looks like a very tough -almost impossible- mission.
View 4 RepliesI'm trying to do something that is turning out to be out of my league at the moment. I need to draw geometric figures. These geometric figures have all the coordinates of their corners. Say I have a trapezoid, and I would want to draw it. The drawing would be done in a picturebox or a panel or a groupbox (some part of the form where only the geometric figure will be).
I saw the method on how to do that Here and that's exactly what I'm trying to achieve, but there it's drawn on a newly created form, and I need it in a picbox, panel or groupbox as I mentioned above. I also need the drawn figure to be at the center of the picbox/panel/groupbox.
The coordinates of the lines should be like (xa.text,ya.text) to (xa.text - xb.text, ya.text + yb.text) if I'm not wrong for the first line of the geometric figure and so on.
How do I draw lines like these ones at top (underneath the white box) and bottom (above the buttons) - preferably in the GUI?
View 6 RepliesI think we can just draw an image that resemble the grid using this article : drawing in a datagridview Currently creating a way to make the image drawn in tile mode. Each time I develop a datacentric application using VB.NET regardless of how much the data displayed in the datagrid, I always want the grid to display full row of empty data, not just blank panel. Can we achieve this using VB.NET design time property? And also, we must not trigger the display of vertical scrollbar this way..
View 1 RepliesI've got a project where I want to be able to display a world map and draw lines between cities.I've looked at using a web browser with google maps but don't want it to have to be used while "online"
I've looked and longitude and latitude and converting these to UTM co-ordinates but i'm lost for how to place these on world map programaticly.I have a full list of all cities used in my program and have a list of their latitude and longitude co-ordinates because i need to work out thier distance apart which I have already done the code for.