Is the datagridview databound?
Do you have a project data source?
Is the datagridview databound?
Do you have a project data source?
Declare the string in the application settings, then call that setting.
Example:
'In Application Settings
Name | Type | Scope | Value
myCon|String|Application|'Your Connection String Here
'In code
Dim con As New OleDBConnection(My.Settings.myCon)
If the string is changed in the application settings - it is changed globally.
Have you tried setting the form properties in designer mode instead?
Just for S's & G's?
No problem!
Please don't forget to close the thread by pressing the ("Mark This Thread as Solved") button at the bottom of the page!
Something like this:
Dim ts As TimeSpan = dtpTimeOut.Value - dtpTimeIn.Value
txtDailyHrs.Text = ts.Hours & ":" & ts.Minutes
Will display like this:
Date1: 08:00AM 1/24/13
Date2: 05:15PM 1/24/13
Text: 9:15
I figured that was the case. Just didn't know how it generated it's "random" number.
More of an oddity than a problem. :)
Thanks TNT!
Upon playing with the graphics/random class - I have discovered something odd.
Private Sub Me_Load(sender As Object, e As EventArgs) Handles Me.Load
For i = 0 To 5000
DrawColor(GimmiRectangle)
Next
End Sub
Private Sub DrawColor(ByVal rNew As Rectangle)
Try
Dim g As Graphics = Me.CreateGraphics
g.DrawRectangle(New Pen(Color.FromArgb(New Random().Next(255), New Random().Next(255), New Random().Next(255))), rNew)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Function GimmiRectangle() As Rectangle
Try
Dim rect As New Rectangle(New Random().Next(1000), New Random().Next(1000), New Random().Next(1000), New Random().Next(1000))
Return rect
Catch ex As Exception
MsgBox(ex.ToString)
Return New Rectangle(0, 0, 0, 0)
End Try
End Function
This code will generate random sized/location rectangles and draw them to the screen. (place on a blank form)
The Random class seems to be not so random. For the most part - the rectangles appear to grow to the bottom right of the screen (with fairly few rendering in the margins.)
Has anyone else noticed this odd behavior with Random?
I must be a wizard!
I set the form border style to none and then set the form to maximize on form load.
Works like a charm for me.
Do you have any special form drawing code?
Upon aiding a friend - I have decided to post the example used here.
The following is a snippet that shows basic class inheritance.
The source file as well as a test case can be found attached.
You can test these classes with the following code:
Dim cNew As New Car
Dim vNew As New Van
Dim tNew As New Truck
With cNew
.Make = "Chevrolet"
.Model = "Camaro"
.Engine = 6.0
.Year = 2013
.Style = Car.StyleOption.Coupe
MsgBox(.ToString)
End With
With vNew
.Make = "Chevrolet"
.Model = "Express"
.Engine = 6.0
.Passengers = 4
.Year = 2013
.Cargo_Rack = True
.Folding_Seats = False
MsgBox(.ToString)
End With
With tNew
.Make = "Chevrolet"
.Model = "Silverado"
.Engine = 6.0
.Year = 2013
.Cab = Truck.CabSize.Crew_Cab
.Torque = 413
MsgBox(.ToString)
End With
The first column in a listview hold's the value placed in the LVI's .Text property.
Example:
|Record| Name | Age | Date |
|.Text |SubItem|SubItem|SubItem|
This being said - you need to change your code to reflect this:
lvwItem = ListView 1. Items. Add (reader.G etString (0))
To:
lvwItem.Text = reader.GetString(0)
lvwItem.SubItems.Add(reader.GetString(1))
lvwItem.SubItems.Add(reader.GetString(2))
Try this to see if the byte value is generating an image correctly:
Using msStream As New IO.MemoryStream(pictureData)
picture = Image.FromStream(msStream)
If IsNothing(picture) = False Then
frm.PB1.Image = picture
Else
MsgBox("Picture returned nothing")
End If
End Using
If this is a third party DLL, it is possible that it is not .NET 4.0 Compliant.
Is it possible to contact the designer of this dll?
There will be a button at the bottom of this page that reads:
"Mark this thread as solved"
No problem friend!
Please do not forget to mark the thread as solved. =)
Try a parameterised query:
"INSERT INTO @Table (col1,col2,col3) VALUES (@val1,@val2,@Val3)"
What error is being thrown?
We can't begin to debug if we don't know the region to start.
Try something like this:
Public Class Main
Dim popup As New Windows.Forms.ToolStripDropDown()
Dim host As Windows.Forms.ToolStripControlHost
Private Sub Open_Click(sender As System.Object, e As System.EventArgs) Handles btnOpen.Click
Try
With popup
.Margin = Windows.Forms.Padding.Empty
.Padding = Windows.Forms.Padding.Empty
.Size = New Size(150, 150)
End With
host = New Windows.Forms.ToolStripControlHost(Panel1)
With host
.Margin = Windows.Forms.Padding.Empty
.Padding = Windows.Forms.Padding.Empty
End With
popup.Items.Add(host)
popup.Show()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub Close_Click(sender As System.Object, e As System.EventArgs) Handles btnClose.Click
Try
popup.Items.Clear()
popup.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
Declare the popup in a class wide variable to be able to manipulate it class wide.
I alsways ask the client to see what is the standard resolution that is targeted. I then design the GUI around this resolution. Always keep in mind that you are designing for the end user, and never for yourself.
Query side, you can try this:
Replace Type with the column that holds your values.
SELECT * From Table ORDER BY Type ASC
For list based, try this:
Dim lstString As New List(of String)
'Add the items to your list
lstString.Sort()
'The default sort function sorts Ascending - for sorting of another type - write your sort function and pass it into the sort's parameters.
Then to load them into the textbox, you can do this:
For i = 0 to lstString.Count - 1
If i < lstString.Count - 1 Then
TextBox1.Text &= lstString(i) & ", "
Else
TextBox1.Text &= lstString(i)
End If
Next
Try a function like this:
Private Function CheckIfYear(byval sYear As String) As Boolean
Try
Dim dt As New DateTime(Cint(sYear),1,1,1,1,1)
Return True
Catch ex As Exception
Return False
End Try
End Function
Then use it in the TextBox's Leave event:
Private Sub TextBox_Leave(sender As System.Object, e As System.EventArgs) Handles TextBox1.Leave
If TextBox1.Text.Length = 4 Then
If CheckIfYear(TextBox1.Text) = False Then
MsgBox("You have entered an incorrect year")
TextBox1.Focus()
End If
Else
MsgBox("Please enter a four digit date.")
TextBox1.Focus()
End If
End Sub
You have three options:
You can call the .Close() Sub procedure:
popup.Close()
This will close it, but the object remains in memory.
You can call the .Dispose() Sub procedure:
popup.Dispose()
This will release all resources for it, but waits for the garbage collector to grab it.
You can also set it to nothing - This will nullify the object:
popup = Nothing
This is a very simplistic approach, see if it does what you want it to do.
For i = 0 To dgViewClients.Rows.Count - 1
For j = 0 To dgViewClients.Rows(i).Cells.Count - 1
If dgViewClients.Rows(i).Cells(j).Value.ToString.ToLower.Contains(strSearch.ToLower) Then
dgViewClients.Rows(i).Selected = True
Return True
End If
Next
Next
Return False
I appologize. I was writing the code quickly - and forgot the New therefore the interpreter looks at the () as an array identifier.
Replace:
Dim curItem as ToolStripControlHost()
With
Dim curItem as New ToolStripControlHost(Panel1)
You are creating a new one every time - but are you deleting the old one?
If Not, you need to keep a reference of it. Maybe a class wide variable called "curItem" and dispose of it before creating the new one?
'Example:
Dim curItem as ToolStripControlHost()
'In Button_Click
If IsNothing(curItem) = False Then curItem = Nothing
'Your Code here
host.Padding = Padding.Empty
'host.Width = 50
curItem = host
popup.Items.Add(host)
Let me try to clarify this a little:
You are:
1) Creating a toolstripdropdown
2) Adding a panel to the dropdown
3) Repeating this process for every time a button is clicked?
Is this true?
Dates will not hold just hours and mintutes, you will have to set a default month,day,year
Dim s As String = "1642"
Dim hourPortion As String = s.ToCharArray(0, 2)
Dim minPortion As String = s.ToCharArray(2, 2)
Dim dt As New DateTime(1900, 1, 1, CInt(hourPortion), CInt(minPortion), 0)
MsgBox(dt.ToShortTimeString())
Will do what you are wanting, but this is a very inefficient way of storing date/time.
This will only work if 4 digit hour/second strings exits - the code will break if there is any change in data.
May I ask why you are storing just hour/minutes?
Could you declare results as a list?
Dim Results As New List(Of String)
While Reader.Read()
Results.Add(Reader(0))
End While
Something like this
Dim diares As Windows.Forms.DialogResult = MsgBox("Test", MsgBoxStyle.YesNoCancel)
If diares = Windows.Forms.DialogResult.Yes Then
MsgBox("Yes pressed")
ElseIf diares = Windows.Forms.DialogResult.No Then
MsgBox("No pressed")
ElseIf diares = Windows.Forms.DialogResult.Cancel Then
MsgBox("Cancel pressed")
End If
No, the .Net framework/Oracle takes care of the rest for you. (Provided you coded the application correctly)
Do as Adam_K has stated and enter the code inside the if statement:
Define a password somewhere(in code or in db)
Private Sub delete_Click()
On Error GoTo Err_cmdDelete_Click
Dim answer as String = Inputbox("Please enter the password:","Password")
If answer = MyPassword Then
DoCmd.SetWarnings False
If MsgBox("Delete this VounteerRecord. Are you sure?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete?") = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
DepartmentName.SetFocus
End If
Exit_delete_Click:
DoCmd.SetWarnings True
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_delete_Click
Else
Exit Sub
End If
End Sub
You can use this for Microsofts instructions on setting the folder cache.
The example is for Windows Server 2008, which I'm sure you can do the same for Windows 7.
You will have to re-write the file.
Example:
Dim SR as New StreamReader(path)
Dim SW as New StreamWriter(path & "tmp")
Do While SR.Peek <> -1
Dim sCur As String = SR.ReadLine
If sCur <> Block Then
SW.WriteLine(sCur)
End If
Loop
SR.Close
SW.Close
'Next Copy Over the original hosts file
File.Copy(path & "tmp", path,True)
You will have to update the biding source be either recreating it or editing it in the GUI.
First thing is to be sure the crystal report is calling the same dataset as above.
This being said, you are passing the DataRow in as ByVal, you need to pass this in as ByRef.
ByVal only changes the underlying data while in the sub (All changes are lost on sub exit.)
ByRef allows the change of data and the data remains when the sub exists.
What do you mean by item analysis?
What kind of items are you wanting to analyze?
As for the code, we can't GIVE you code - We aren't a DO forum we are a HELP forum.
For the server you can do the following:
Get Client Name
Check if new client:
Dim pathscheme As String = PathOnServer & SomeUniqueClientValue 'Like a GUID
If IO.Directory.Exists(pathscheme) = False Then
IO.Directory.Create(pathscheme)
End IF
On client Side, you do the same:
If IO.Directory.Exists(pathtoserver) = False Then
MsgBox("No Directory Found @" & vbcrlf & pathtoserver)
'Disable controls here
End If
As for the bulk of the code, you are going to have to write some before we can help you out.
Whichever can envelop the "in" crowd will be the victor.
There is a lot of money to be made through the use hype.
For the select, you can place the following code in your procedure:
Try
Dim da As New OleDb.OleDbDataAdapter(New OleDb.OleDbCommand("SELECT * FROM usertbl WHERE type='" & cboType.Text & "'", dataconn))
Dim ds As New DataSet
da.Fill(ds, "Type")
If IsNothing(ds.Tables("Type")) = False And ds.Tables("Type").Rows.Count > 0 Then
cboName.Items.Clear()
For i = 0 To ds.Tables("Type").Rows.Count - 1
cboName.Items.Add(ds.Tables("Type").Rows(i)("Username"))
Next
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Can you do us a HUGE favor and indent your code for easier reading?
You can do this by pressing Tab to indent the code. You will see the text turn green when it is done correctly.
Are you using a custom DLL?
If So, you can try this.
If not - is it possible to post the code around Line 12 of the MakePayment form?
Are you calling this from code?
If so, can you please post the code that is giving you this problem?
We're good, but we're not THAT good. =)
Can you post the part of the code that is throwing the error?
Or is it throwing the error on the first string read in?
Are you programming with option strict on?
Create a list of string and cycle through them:
'Where sr is a stream reader
Dim lstIngredients As List(Of String) = sr.ReadLine().Split(",").ToList
'lstIngredients(0) = 150
'lstIngredients(1) = Flour
'lstIngredients(2) = Grams