|
|
how to get text of selected item in listview?
Please help....
|
|
|
|
|
ListBox1.SelectedItem ' gets or sets teh selected items in listbox
Listbox1.SelectedIndex ' gets the selected item's index number in listbox
Try!
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
how to create sql database in with userdefined name at runtime through vb.net
|
|
|
|
|
Create a connection to the master database on the SQL Server.
Create a SqlCommand that issues the CREATE DATABASE command (see SQL Books on line for details - I've no idea of your situation and I'm not going to second guess).
Then you ExecuteNonQuery on the command.
If the create command worked then you can now connect to your new database.
|
|
|
|
|
about this I have already tried out this it woks well if the database is in sql 2000 but if the database is to be created in sql 2005 it does not allow.
to solve the problem i have tried out many way but could not get it so can explain with some example.
thanx for the support
taher
|
|
|
|
|
Well try using "SQLDMO" dll
This code worked for SQL 2000.
Some code -
Imports System.Data.SqlClient
Imports SQLDMO
'Lists available servers
Private oSqlServer As New SQLDMO.SQLServer
Dim sqlDmoApplication As New SQLDMO.Application
Dim serverList As SQLDMO.NameList
serverList = sqlDmoApplication.ListAvailableSQLServers()
'Create Database
Private Function createDB() As Boolean
Dim oDatabase As SQLDMO.Database
Dim oDBFileData As SQLDMO.DBFile
Dim oLogFile As SQLDMO.LogFile
oDatabase = New Database
oDBFileData = New DBFile
oLogFile = New LogFile
Try
'Delete Database if it exists
Call connectDB()
'If Not IsNothing(oSqlServer.Databases.Item(txtDBName.Text.Trim())) Then
'oSqlServer.Databases.Item(DBToCreate).Remove()
'Response.Write("Database with same name already exists")
'End If
For i As Integer = 1 To oSqlServer.Databases.Count
If txtDBName.Text.Trim().ToUpper = oSqlServer.Databases.Item(i).Name.Trim.ToUpper() Then
lblAlert.Text = ("Database with same name already exists, please mention different name")
Return False
End If
Next
oDatabase.Name = txtDBName.Text.Trim() '"SOM_DB"
' Define the PRIMARY data file.
oDBFileData.Name = txtDBName.Text.Trim() & "Data"
' Replace the following path with your own path to a database folder.
oDBFileData.PhysicalName = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" & txtDBName.Text.Trim() & "_DB.mdf"
oDBFileData.PrimaryFile = True
' Specify file growth in chunks of fixed size for all data files.
oDBFileData.FileGrowthType = SQLDMO.SQLDMO_GROWTH_TYPE.SQLDMOGrowth_MB
oDBFileData.FileGrowth = 1
oDatabase.FileGroups.Item("PRIMARY").DBFiles.Add(oDBFileData)
' Define the database transaction log.
oLogFile.Name = txtDBName.Text.Trim() & "Log1"
' Replace the following path with your own path to a database folder.
oLogFile.PhysicalName = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" & txtDBName.Text.Trim() & "_DB.ldf"
oDatabase.TransactionLog.LogFiles.Add(oLogFile)
oSqlServer.Databases.Add(oDatabase)
oDatabase = Nothing
oDBFileData = Nothing
oLogFile = Nothing
Return True
Catch ex As Exception
lblAlert.Text = "Error : " & ex.Message()
Return False
End Try
End Function
"If our Mind can, the Program can !!"
|
|
|
|
|
i am again putting up the same question
there is some prob with the behavoiur of vb
in my code i hve placed only one debug statement.. but when i check the immediate wind it shows values twice..
i tried to put break point (anywhere in the code ) that time it showed values only once , but once i remove the break boint it shows values twice again, same happened by putting message box, the big problem is it shows diff values with and without break points
this function is obnly called once in the whole program
Private Sub calculatebalance()
If cheque1 = False Then
balance = instdue * noq + moretorium
ElseIf cheque2 = False Then
Dim previnstdue As Long
previnstdue = rs_clients!clientamounttdue
balance = instdue * noq + moretorium + prevmoretorium + (qtrdiff * previnstdue)
Debug.Print instdue, balance
End If
End Sub
i desparetely need help
can anbdy help me out
mubashir
|
|
|
|
|
Debug.print has two syntaxes. Accordign to your debug statement you have used the second syntax Print (Format as string, ParamArrayArg() as object). That mnight be the issue probably.
Try
debug.Print Instdue.toString
debug.Print balance.toString
also you can use debug.write or debug.writeln
I hope that helps.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
my prob is not the debug statement , but the values it shows, i mean wiht out break statment my form displays diff values while with breakpoint it displays diff values.. i dont even change a single line of code all i do is put a break stament which changes the values.. dont know how to solve this prob....
|
|
|
|
|
I want to develop a bar chart with the following requirements:
An activity is represented as a box / rectangle with different colors. The colours change according to the activity. The width of the box determines the duration of the activity and is linked to start date and end date in a database record. The order of the activities will be changed by dragging the boxes (in the same row) and the record should be updated automatically. There are many people who are assigned these activities, which are represented in different rows. I should also be able to drag the boxes from one row to another with an immediate update of database.
Could anyone help in telling me the best approach for this task? I am just an intermediate programmer. I hope that my requirement is understandable. Please help me...
|
|
|
|
|
I've tried so many different way's of doing this and I'm sure the solution is simple, I just need a push in the right direction!
Sorry that this post is so long but people usually misunderstand me on this topic.
All I want to do is to establish a client-server connection between two computers of which the one is behind a hardware firewall (A.K.A proxy server). The word PROXY in this case refers to a computer with two NIC's, one to the internet and one to the LAN. This proxy server has a whitelist of allowed sites, ports and protocols.
Eg. Any PC on the lan can connect to www.news24.com, because the website is whitelisted. In the same manner any PC on the LAN can send and receive emails. In the event where a client attempts to access a website not on the whitelist he is promted for a password that will grant the access.
I want users of my app to be able to specify wheter they use a proxy server or not and what the address of that server is. Let's assume the proxy server has been set up to allow communication on that specific port (i.e I'm not trying to trick, hack or bypass the firewall, the connection is legitimate)
A good example of this is MSN Live Messenger, see it's connection setup screen here[^]
My actual question is, how do I implement this proxy into my connection, do I need to connect to the proxy first and then somehow request it forward my connection?
PS. This is not a web-request (eg. http get/post request)
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
The proxy has to be configured (NOT from your code, but by your proxy server admin) to open a port to the public and forward it to your servers internal IP and port.
If it was so easy to get the proxy to open a hole from code, image what all these Trojan virus writers could do!
Your client would connect to the public IP and this opened port. The proxy then forwards this request to your server on its internal IP and port number.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: If it was so easy to get the proxy to open a hole from code, image what all these Trojan virus writers could do!
I'm not exactly asking how to open a hole from code, I'm asking how to pass through the hole already opened for me on the firewall by our proxy server admin.
Where do I specify the address of the proxy server? In code? In Internet Explorer?...Will my app use those IE settings?.....But thats only for stuff like HTTP, FTP etc...
Do I connect directly to my end-point or do I need to establish a connection to the Proxy first?
"you can't forget something you never knew..." M. Du Toit
"Watching Migthy Joe Young made me hate my life..................................I want a gorilla!" A. Havemann
|
|
|
|
|
How to add a MSHFLEX GRID in a form
It is not displayed in Tool box. Which DLL we have to add to get Reference for the MSHFLEXGRID.
THanks in Advance
Priya
|
|
|
|
|
You could use the flexgrid, but what's stopping you from using the built-in .NET DataGrid or DataGridView instead?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Generally in Connection string we will give the path as
Data source="D:\xyz.mdb"
In VB we will write the same code as
Data Source=" & App.Path & "\DC.mdb"
How to set the same datsource in VB.Net
Waiting for ur reply
Thanks in advance
Priya
|
|
|
|
|
Environment.CurrentDirectory
However, be aware that this can be changed during run time.
|
|
|
|
|
How many times are you going to ask the same question??
The VB.NET equiv is:
Dim dataSource As String = Path.Combine(Application.StartupPath, "DC.MDB")
This is the first time I'm going to disagree with Colin. I don't like using CurrentDirectory because its a path that can change during the exeuction of your code. Just ask anyone who has ever used the OpenFile and SaveFile Dialog boxes incorrectly...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi friends i couldnot find any tools for creating frames in vb.net..please give me your valuable suggestion...
jeyan
|
|
|
|
|
what do you mean with frames? A rectangle, A panel object? If you be specific, I will help you.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
|
Okay here is the method how to set background color for selected cells in a datagridview control.
DataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect
Dim I As Int32 = 0
For I = 1 To DataGridView1.SelectedCells.Count
DataGridView1.SelectedCells(I).DataGridView.BackgroundColor = Color.Aqua
Next
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Hello,
[2005]
I have a datagrid that is bound to a typed dataset. I have a combo box that is bound to the same typed dataset.
The user will select from the combo a category the bindingsource will filter only the categories that the user wants displayed in the datagrid.
However, i have button called reset, which should display everything back into the dataset. However, it doesn't do this. I have checked to see how many record are contained in the dataset after the reset button is clicked during the debugger and the number of rows is correct.
The dataset are filled during the form load and when the user clicks the reset button
I know that everytime the dataset gets filled, it is cleared and filled automatically, so I don't understand why this would happen. My code is below. Thanks for any advice on this code.
'Load categories into equipment category combo box<br />
Private Sub LoadCategories()<br />
Try<br />
Me.cboCategory.DataSource = Me.DsAddComponetAndEquipment1.SoftwareCategory<br />
Me.cboCategory.DisplayMember = "Category"<br />
Me.cboCategory.ValueMember = "CategoryID"<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub
'Load all the components into the grid<br />
Private Sub LoadAllSoftware()<br />
Try<br />
Me.TA_Software_dsComponent_Equipment1.Fill(Me.DsAddComponetAndEquipment1.Software)<br />
Me.dgvSoftware.DataSource = Me.DsAddComponetAndEquipment1.Software<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub
'Reload all software<br />
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click<br />
Me.LoadAllSoftware()<br />
End Sub
'Display what the user has selected from the category of sofware<br />
Private Sub cboCategory_SelectionChangeCommitted(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboCategory.SelectionChangeCommitted<br />
Dim bsCategory As New BindingSource<br />
<br />
Try<br />
bsCategory.DataSource = Me.DsAddComponetAndEquipment1.Software<br />
bsCategory.Filter = String.Format("CategoryID = {0}", Me.cboCategory.SelectedValue)<br />
<br />
Me.dgvSoftware.DataSource = bsCategory<br />
<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub
Thanks very much for your time,
Steve
|
|
|
|
|
Hi Steve,
First thing that comes to mind with your code (although it hasn't got anything to do with the problem) is that you really don't have to use me. everywhere, and MessageBox.Show doesn't need .Show .
As for the actual problem though:
steve_rm wrote: 'Load all the components into the grid
Private Sub LoadAllSoftware()
Try
Me.TA_Software_dsComponent_Equipment1.Fill(Me.DsAddComponetAndEquipment1.Software)
Me.dgvSoftware.DataSource = Me.DsAddComponetAndEquipment1.Software
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
You could try:
<br />
dgvSoftware.DataSource = DsAddComponetAndEquipment1<br />
dgvSoftware.DataMember = "Software"<br />
or alternatively you could try:
<br />
dgvSoftware.SetDataBinding(DsAddComponetAndEquipment1, "Software")<br />
steve_rm wrote: [2005]
I take it that you mean that you are using .NET 2005? Unfortunately my boss doesn't want to invest in the upgrade yet, so I am still looking at it from the .NET 2003 point of view. Therefore it is ofcourse possible that my code doesn't apply for your environment anymore, but otherwise, are you sure that .fill actually empties the dataset first before filling it again? For me that doesn't work, I still need to call DataSet1.clear() first.
Now if binding works when your form is loaded, than maybe you should think of doing the .fill thing only once (at the beginning), copy the whole dataset into a temporary dataset, and just copy the temporary ds back to your main ds when the user presses the reset button.
The active data binding should take care of the rest.
Hope this is of use to you,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|