|
Not sure if this is the best way but it works for me.
The following code runs when the user wants to edit the the grid data. I put this in the button click.
Dim cm As CurrencyManager
cm = DataGrid1.BindingContext(DataGrid1.DataSource, DataGrid1.DataMember)
Dim xdrv As DataRowView
xdrv = cm.Current
Dim xrow As DataRow
xrow = xdrv.Row
Form2.Tag = CStr(xrow.Item("PrimaryIndexField"))
Then in Form2 locate for the Tag property value in the DataTable Form2 uses.
|
|
|
|
|
Use the DataGrid Cell_Changed Event of the DataGrid
the code in the Cell_Changed Event handler may be like
TextBox1.Text = DataGrid1.Item(DataGrid1.CurrentRowIndex, 0) for first column
TextBox2.Text = DataGrid1.Item(DataGrid1.CurrentRowIndex, 2) for second column
and so on
Thank You
|
|
|
|
|
I have a dataset that was filled with 15 rows of 7 columns from an SQL database. The desired row in the dataset is selected from a dropdownlist combobox. How do I select the different columns within the row? More specific, if the combobox selection is index 2, how do you access the value of App from the dataset?
Dataset Layout:
DID Dist Num App HR Sec SIS
My code so far:
Dim myCMD As OleDbCommand = New OleDbCommand
Dim myAdapter As OleDbDataAdapter = New OleDbDataAdapter
Dim dsDistrict As DataSet = New DataSet
Dim objDistrict As DataView
Dim intDistrictIndex As Integer
Dim MZKApp As String
Dim MZKHR As String
Dim MZKSec As String
Dim MZKSIS As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myConn.ConnectionString = "Provider=" & …
myConn.Open()
myCMD.CommandText = "SELECT * FROM GTWDistricts ORDER BY Num"
myCMD.Connection = myConn
myAdapter.SelectCommand = myCMD
dsDistrict.Clear()
myAdapter.Fill(dsDistrict, "GTWDistricts")
cbDistrict.DataBindings.Clear()
objDistrict = New DataView(dsDistrict.Tables("GTWDistricts"))
cbDistrict.DataBindings.Add("text", objDistrict, "Dist")
cbDistrict.DataSource = objDistrict
cbDistrict.ValueMember = "DID"
cbDistrict.DisplayMember = "Dist"
cbDistrict.SelectedIndex = 0
SetDBNames()
myConn.Close()
Private Sub SetDBNames()
MZKApp =
MZKHRFin =
MZKSecur =
MZKSIS =
End Sub
|
|
|
|
|
Hello. I'm new in this field and I'm looking for documentation regarding visual basic.net. What I am trying to do is to transform some application I developed in MS Access with VB script in VB.NET. I've decided to use the jet engine because the database will never have a size bigger that 1GB (I expect more like 200MB maximum)... So... what I need is books about jet engine working with vb.net. Send me some links pls or some e-books. Thank you very much.
Regards.
Gabriel
|
|
|
|
|
There are heaps of articles online about connecting an Access database to VB.NET. Try google.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The best site for Ebooks that I have explored so far is
http://giuciao.atspace.org
I hope you will love this site
Thank You
|
|
|
|
|
|
Hi,
I have a program which runs a crc32 on a file. It can take up to 5mins to give a result but while it is running the crc the window freezes. Is there anyway to stop this from happening as I need to add a progress bar but it will not work right if the window freezes.
|
|
|
|
|
|
Is their a way to encrypt the connection string to a SQL Server? I don't want to send the password in plaintext.
Thanks
|
|
|
|
|
The Following function will solve your problem.
First Argument requirs string as "E" to Encrypt and "D" to Decrypt.
Second Argument is Key to Encryption the same key will be used to decrypt to orignal matter.
Third string is what you want to encrypt and then back to decrypt.
Function crypt(Action As String, Key As String, Src As String) As String
Dim Count As Integer, KeyPos As Integer, KeyLen As Integer, SrcAsc As Integer, dest As String, offset As Integer, TmpSrcAsc, SrcPos
KeyLen = Len(Key)
If Action = "E" Then
Randomize
offset = (Rnd * 10000 Mod 255) + 1
dest = Hex$(offset) ' problem with "offset" of single digit hex numbers
' when decodeing, decode procedure is looking for 2 digits, whereis lower number produce single digit hex numbers (ie 1,2,3,12...)
If Len(dest) = 1 Then ' adds 0 in front of single digit hex numbers
dest = "0" + dest
End If
For SrcPos = 1 To Len(Src)
SrcAsc = (Asc(Mid$(Src, SrcPos, 1)) + offset) Mod 255
If KeyPos < KeyLen Then KeyPos = KeyPos + 1 Else KeyPos = 1
'Fill Dest$ with HEX representation of Encrypted field
'Hex used to keep nasties such as eof or lf from mangling stream
'Use format$ to make Hex$ return " 0" instead of "0" when the same
'values are Xor'ed together (Null) - keeps placeholder for decrypt
SrcAsc = SrcAsc Xor Asc(Mid$(Key, KeyPos, 1))
dest = dest + Format$(Hex$(SrcAsc), "@@")
offset = SrcAsc
Next
ElseIf Action = "D" Then
offset = val("&H" + Left$(Src, 2))
For SrcPos = 3 To Len(Src) Step 2
SrcAsc = val("&H" + Trim(Mid$(Src, SrcPos, 2)))
If KeyPos < KeyLen Then KeyPos = KeyPos + 1 Else KeyPos = 1
TmpSrcAsc = SrcAsc Xor Asc(Mid$(Key, KeyPos, 1))
If TmpSrcAsc <= offset Then
TmpSrcAsc = 255 + TmpSrcAsc - offset
Else
TmpSrcAsc = TmpSrcAsc - offset
End If
dest = dest + Chr(TmpSrcAsc)
offset = SrcAsc
Next
End If
crypt = dest
End Function
Shoaib Nawaz
-- modified at 2:07 Friday 16th September, 2005
|
|
|
|
|
I have developed a windows client app that connects to a web service and a centralised database. The application works fine apart from on one of the PC's.
The error:
'The underlying connection was closed: The remote name could not be resolved.'
only appears on that particular machine. I have searched for a solution and have found articles suggesting to change the web proxy settings, but they must be correct if all the other client machines are working fine.
Please can someone help.
Thank You
Lee
|
|
|
|
|
Is it possible to backup and restore a database using VB .NET? I've tried to find some help by searching, but I haven't located any help. The database will be stored in SQL Server 2000.
Thanks
|
|
|
|
|
You could, but it's much easier just to setup SQL Server to do it for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
SQL server backups and restores are standard SQL commands, send them as you would any other command.
|
|
|
|
|
Hi,
Let me know from which way you want to take backup?
If you want to do it through GUI you can easily do by right click on database.
If you want to do it by SQL Command then try it
Sql Command:
Backup Database databasename with init.
try it then inform me.
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
I will be doing it from within a VB .NET application. So it would probably be the sql command. I'll give it a try when I get to that part of the implementation.
thanks for the reply.
|
|
|
|
|
Hi
I am customizing the Crystal Report Viewer to set it to the color standards we have. I did all the changes but stuck with the Border color change of the Viewer. I tried drawing a line in the Paint event of the viewer but didn't help.
Does anyone know how can i change the Border Grey colour of the Crystal Report Viewer ?
Thanks
|
|
|
|
|
I want to put my referenced assemblies in a subfolder of \bin .. like \bin\assemblies. My application is in \bin.
By fefault .NET puts my app/assembly in same folder as my referenced assemblies. i use "Local Copy" of all references.
Is there a way to tell .NEt to use other locations?
//Maw
|
|
|
|
|
I'm using stored procedure to update my data through data adapter. I've initialized only the insert and update command of the data adapter to the name of the stored procedures and both the stored procedures are having the select statement for inserted/updated data.
The problem is that I'm not able to get the refereshed data back in my dataset ??
|
|
|
|
|
I am trying to get enbedded reports to open on a machine that does have crystal installed on it. I follow all the instructions given by vb and crystal, but still i get a error
The error on the machine:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.TypeInitializationException: The type initializer for "CrystalDecisions.CrystalReports.Engine.ReportDocument" threw an exception. ---> System.Runtime.InteropServices.COMException (0x80040154): COM object with CLSID {CF76A644-314B-404D-8D45-F08B51FF990B} is either not valid or not registered.
Help Please !?!
|
|
|
|
|
hi guys!
i have developed a vb.net application which works on LAN and have a single database server.
in my app a retrive date and time of the client machine on which application is installed which is creating problems as some time date time format error occurs, system date modification problem also occurs.
i want that in my application i should retrive the date and time of the server. is it possible.
can any one tell me the way retriving server date and time
bi
abhinav
|
|
|
|
|
Since you're talking to an SQL Server, you can get the current date/time from a stored procedure. SQL Server uses GETDATE() to return the local date and time of the box the server is running on.
SELECT GETDATE()
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
If there is no SQL Server installed how can you retrieve the date/time from the network server itself?
|
|
|
|
|
If yur server is running the TCP/IP DateTime Service, you could write your own Telnet client and connect to it on Port 13. The service will return the server's date and time as a text. You'll then have to parse it up to get the information you want.
Another option would be to write your own Windows Service to return the server's date/time using either TCP/IP sockets (like the DateTime service does) to communicate or .NET Remoting.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|