Hi,
You can import:
Imports System.Data
Imports System.Data.SqlClient
I hope it helps.
Hi,
You can import:
Imports System.Data
Imports System.Data.SqlClient
I hope it helps.
Hi John,
Thank you for the reply.. I used the Publish method to create a setup file of my project. But I have another problem. When I try to install it in the other computer which does not have VB installed, it does not execute. It gives an error message something like files missing....
i am actually trying to create a set / installation file so that I can run and install my project / software on other computers ....
Hi,
When you want to instal your program to a Pc that doesn't have VB then you need to instal the .Net Framework on that PC.
What you can do is:
1 With a project selected in Solution Explorer, on the Project menu click Properties.
2 Select the Publish pane.
3 Click the Prerequisites button to open the Prerequisites dialog box.
4 In the Prerequisites dialog box, make sure that the Create setup program to install prerequisite components check box is selected.
5 In the Specify the install location for prerequisites section, select Download prerequisites from the following location.
6 Select a location from the drop-down list, or enter a URL, file path, or FTP location, and then click OK.
Secondly, during the publishing wizard you need to Add all the files needed for your program to work porperly on the other PC's.
Hi,
You can try something like this:
Private Sub button1_Click(sender As Object, e As EventArgs)
Dim strExport As String = ""
'Loop through all the columns in DataGridView to Set the
'Column Heading
For Each dc As DataGridViewColumn In dataGridView1.Columns
strExport += dc.Name + " "
Next
strExport = strExport.Substring(0, strExport.Length - 3) & Environment.NewLine.ToString()
'Loop through all the row and append the value with 3 spaces
For Each dr As DataGridViewRow In dataGridView1.Rows
For Each dc As DataGridViewCell In dr.Cells
If dc.Value IsNot Nothing Then
strExport += dc.Value.ToString() & " "
End If
Next
strExport += Environment.NewLine.ToString()
Next
strExport = strExport.Substring(0, strExport.Length - 3) & Environment.NewLine.ToString()
'Create a TextWrite object to write to file, select a file name with .csv extention
Dim tw As System.IO.TextWriter = New System.IO.StreamWriter("data.csv")
'Write the Text to file
tw.Write(strExport)
'Close the Textwrite
tw.Close()
End Sub
I haven't tested it.
Hi,
I think you should do it this way.
Add this part of code into a Button Click event:
If Me.WebBrowser1.DocumentText.Contains("Login") Then
MsgBox("The login is ok!")
End If
Hi,
Can you show us what do you have so far?
Hi,
You can try something like this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If DateTimePicker1.Value > DateTimePicker2.Value Then
MsgBox("Wrong Date")
Else
MsgBox("Good Date")
End If
End Sub
Hi,
What do you have so far?
Hi pramodsajwan07,
You should start a new thread for your problem.
This thread is solved and exist already from May 2nd.
Thanks.
Hello to everyone,
I have a program that gets some information from the user and updates the database.
I also have two DataGridView, OpenOrders and ItemsInOrder
When the user click on a cell in the OpenOrders a CellChange event is triggered and it updates the ItemsInOrder grid view...
Now after I update the quantity of a product i want to cause that CellChange event to trigger again in order to refresh the ItemsInOrder grid view.
How can i trigger it programmatically?
Thanks in advance!
Hi,
I think you can use the Datagridview.CellValueChanged event for this, look here.
Hi,
Did you actually include your database in your project or just reference it from the config file? If you add the database the database (right click your project in the project explorer and select "Add existing item..." and go find your database.
Hi,
You can find New Languages via New Project -> Open Other Languages.
Hi,
What do you have so far?
Hi,
You can try this:
Dim i As Integer
For i = 0 To Products.Length – 1
Products(i).Qty = 0
Next
And:
Dim textfile As StreamWriter
textfile = File.CreateText(FileName(OrderDate))
Dim i As Integer
For i = 0 To Products.Length – 1
If Products(i).Qty > 0 Then
textfile.WriteLine(Products(i).UPC)
textfile.WriteLine(Products(i).Qty)
End If
Next
textfile.Close()
Hi,
He're some examples how to play with Dates and Time.
See, wich one you need:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = TimeOfDay.ToLongTimeString
Label2.Text = DateAndTime.Now.ToString
End Sub
Hi,
I should use a Class for this so that you can call it instead of writing the whole code over again.
Hi,
I think a better way of doing this to use the Arrowkeys.
The reason way is, if the user needs the letter W or Q then he can't use it because of another action.
Hi,
What I meant with " myColumn" is the name of the column you want to be added into the autocomplete textbox.
Hi,
This:
Else FutureJob = future
Should be:
Else
FutureJob = future
Hi,
I've one more question:
What will you do if the number doesn't match in listbox2?
Hi,
If that solved your question.
Mark your thread as solved. :)
Hi,
The error message you've got is for wich line?
Hello zambag,
You should create a new thread, because this thread is solved.
Thanks,
Luc001
I would also like a way to eliminate having 40 textboxes on a page lol, because the idea was to have a pop up box or something open that would let the user submit it and then return to the question instead of hiding textboxes
Hi,
You can try the inputbox for that.
To work with the InputBox, drag a Command Button and a TextBox from the Toolbar. Opon clicking the Command Button the InputBox prompts asks for a name. Once entered, press OK. That text will now be displayed in the Textbox.
The sample code for the click event
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles Button1.Click
Dim Show As String
Show = InputBox("Enter your name")
TextBox1.Text = Show
End Sub
Hi,
You can try this:
For Each dr As DataRow In myDataSet.myTable.Rows
Me.toolStripTextBox1.AutoCompleteCustomSource.Add(dr("myColumn").ToString())
Next
Make sure you have your AutoCompleteSource set to CustomSource.
Hi,
To delete the last typed char you need this:
Private Sub btnBackSpace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBackSpace.Click
If (lblDisplay.Text.Length > 0) Then
d = lblDisplay.Text.Length
lblDisplay.Text = lblDisplay.Text.Remove(d - 1, 1)
End If
End Sub
To change the value signal, you need this:
Private Sub bttnNegate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttnNegate.Click
lblDisplay.Text = -CSng(lblDisplay.Text)
ClearDisplay = True
End Sub
Hi,
Here's an example how to save the listboxitems to a textfile:
Private Shared Sub WriteToFile()
Dim SW As StreamWriter
SW = File.Create("c:\MyTextFile.txt")
For Each item As ListItem In ListBox.items
SW.WriteLine(item.text)
Next
SW.Close()
End Sub
Hi ashwinshenoy,
No problem :)
I'm pleased that my suggestion helped you for your application.
Grts,
Luc
Hi,
What you also can do is to create a splasscreen.
In that screen you can add some program information like Name, programmers, version, etc...
Add a progressbar and when the value reach 3 sec. then show the form load.
Hi,
An easier way is to use the BindingNavigator Class. Once you are able to bind to your data source, the rest is a walk-over. I'm posting a sample code I used before to demonstrate how it works.
This code uses the Northwind database so it is easy to recreate. You need for buttons: btnFirst, btnPrevious, btnNext and btnLast:
Imports System.Data.SqlClient
Public Class Form1
'Private bindingSource1 As BindingSource
Private bindingSource1 As BindingSource = New BindingSource()
Private employeeTable As New DataTable
Dim connectionString As String = "Data Source=.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True"
Dim connection As New SqlConnection(connectionString)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'connection.ConnectionString = connectionString
Dim employeeAdapter As New SqlDataAdapter _
(New SqlCommand("Select * FROM Employees " _
& "ORDER BY LastName", connection))
connection.Open()
employeeAdapter.Fill(employeeTable)
connection.Close()
' Set the DataSource property of the BindingSource to the employee table.
bindingSource1.DataSource = employeeTable
' Set up the binding to the ReportsTo column.
Dim reportsToBinding As Binding = _
TextBox2.DataBindings.Add("Text", bindingSource1, "ReportsTo", _
True)
' Set the NullValue property for this binding.
reportsToBinding.NullValue = "No Manager"
' Set up the remaining binding.
TextBox1.DataBindings.Add("Text", bindingSource1, "LastName", True)
End Sub
' Move through the data when the button is clicked.
Private Sub btnNext_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles btnNext.Click
bindingSource1.MoveNext()
End Sub
' Move through the data when the button is clicked.
Private Sub btnPrev_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles btnPrev.Click
bindingSource1.MovePrevious()
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, …
Hi,
You want to print the bill.
What's that the bill?
How did you showed the ordered food by the costumer?
........
It's like walking in the dark without any lights...
Give us some light and I'm sure you'll have a solution for your problem :)
Hi,
You should do something like this:
Private treeViewWithToolTips As TreeView
Private Sub InitializeTreeViewWithToolTips()
treeViewWithToolTips = New TreeView()
Dim node1 As New TreeNode("Node1")
node1.ToolTipText = "Help for Node1"
Dim node2 As New TreeNode("Node2")
node2.ToolTipText = "A Tip for Node2"
treeViewWithToolTips.Nodes.AddRange(New TreeNode() {node1, node2})
treeViewWithToolTips.ShowNodeToolTips = True
Me.Controls.Add(treeViewWithToolTips)
End Sub
Hi,
Here's an example:
Dim associatedChar As Char
' Returns "A".
associatedChar = Chr(65)
' Returns "a".
associatedChar = Chr(97)
' Returns ">".
associatedChar = Chr(62)
' Returns "%".
associatedChar = Chr(37)
Hi,
One way to do that in WinForms would dock a TableLayoutPanel into the form. Then you dock all the controls in cells of the TableLayoutPanel. I mean Dock=DockStyle.Fill in all cases. When you maximize the form, all the controls will be stretched or compressed to match the screen size.
It's more flexible than it sounds. For example, if you want a column of buttons with spacing between them, you could dock them into a column of the table, and set their Margin properties to get the spacing. If you want a Panel larger than a single cell, you could get it to span 3 columns wide and 4 rows high. The resizing will still work.
If you are prepared to go to WPF you can get even better results because it is designed to be resolution-independent. Details like the font size and the thickness of borders will be resized too, not just the width and height of the controls.
If you want some more information about rendering with WPF, look here.
Hi,
I think you should use a powerpointviewer for that instead of the powerpoint.exe .
That means that you can use an ActiveX control like the activex control from windows media player.
To download the powerpointviewer look, here.
After you downloaded and installed the viewer you can find the AciveX control in the Com components.
Just a thought.
Hi msqueen082,
It was no problem to help you with the other part of your code.
To avoid that other members will help you with your other problem: Julian dates.
You should first solved this thread and open another one with your Julian's dates problem.
Thanks in advance.
I have to use dates in calculation ... like a client types a appointment datat in textbox and in another textbox it shows that the date has to be between two days.
(appointment written in text box has to be 90 days after today but less than 100 days and also appointment cannot be not less than 80 of today)
Hi,
I'm not that sure what you want about 100 days and 80 days, but here's a way how to do it with 90 days.
Dim ts As TimeSpan
ts = aptDate.Subtract(dteToday)
TextBox1.Text = "Confirmed:" & " " & dteToday.AddDays(90) & " " & (", " & ts.Days & " " & "days until appointment")
Hi,
Did you added that desktop icon again to the newer version setup of your application.
If not I think you should try that.