|
How to populate the column header to all records. I am using Vb.net 2005.
Any body help me? It is urgent. Please!!
Example: (In Microsoft Access Database)
Header-- Name Designation Salary
Gopi Jr. Programmer 10,000
Mani Sr. Analysist 10,000
Kamal Database Admin 25,000
Need the Output: ( I Need the output to Notepad )
Name: Gopi
Designation: Jr.Programmer
Salary: 10,0000
---------------------------------
Name: Mani
Designation: Sr. Analysist
Salary: 10,000
---------------------------------
Name: Kamal
Designation: Database Admin
Salary: 25,000
----------------------------------
Please sent the code to my mail id. it is very help full for me.
E-Mail: agopi_2005_ind@yahoo.co.in, agopi.net@gmail.com
Regards,
Gopi A.
|
|
|
|
|
Member 4027617 wrote: Please sent the code to my mail id. it is very help full for me.
E-Mail: agopi_2005_ind@yahoo.co.in, agopi.net@gmail.com
Wow - you're really a bit stupid, aren't you ? That's two email addresses that will get spammed by spam bots now.
Member 4027617 wrote: Need the Output: ( I Need the output to Notepad )
Member 4027617 wrote: It is urgent.
Seeing as you can't do your own job, perhaps you need to pay someone to do it for you ? I mean, we're here to help, not to do your job. What have you tried ? Anything ? Did you google it ? Do you have any idea what you're doing ?
You have asked two questions.
1 - output to notepad. I assume you mean output to a text file ? File.WriteAllText will do that. Process.Start will open the file in notepad.
2 - formatting your data. Your best bet here may well be to read your data, then iterate over it and build the format you want, given that you have to build it into a string to save it in the first place.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi,
I need help. if you know this please post the code. No need the comments. Do you know what i am doing? why i am asking this for urgent? Don't insult any other like this. Really I am working in BPO Concern. Just i develop the tool for our work. I will help us and reduce the time. We have take more hours for this output (Manual work). If you know this please help me.
Don't Mistake me. Please help me.. Please..
|
|
|
|
|
Use a select statement (query) or stored procedure to open up a datareader, then open a connection to a text file using the filesystem object. Use a loop to read through the datareader and append a line to the text file for each item you want.
Here's the pseudo code - you fill in the rest.
Open datareader
Open file for Append
do while not datareader.eof
file.write("Name: " & datareader("Name"))
file.write("Designation: " & datareader("Designation"))
file.write("Salary: " & datareader("Salary"))
file.write("------------------------")
loop
file.close
datareader.dispose
|
|
|
|
|
Hi,
thanks for the help. Till I didn't tried your code. Anyway, Here We know the header. But in our database we have unknown header and also we don't know how may column. So please help me.
I have unknown header also many columns and rows. Please help me..
|
|
|
|
|
Good day! I have a problem using DataGridView. Here's my code.
Public Class MyLibrary
Private _dgv As DataGridView
Private _recordBLL As RecordBLL
Private _dt As DataTable
Public Sub New()
Me._dgv = New DataGridView
Me._recordBLL = New RecordBLL
Me._dt = New DataTable
Me._dt = recordBLL.PrincipalMember
Me._dgv.DataSource = dt
'********* Error is displaying here ********
With Me._dgv
.Columns(0).Visible = False
.Columns(1).Width = 200
.Columns(2).Width = 600
.Columns(3).Width = 150
.Columns(3).DefaultCellStyle.Format = "MM/dd/yyyy"
End With
End Sub
ReadOnly Property MyDataGridView() As DataGridView
Get
Return _dgv
End Get
End Property
End Class
And I encountered this error. "Index was out of range. Must be non-negative and less than the size of the collection." But the data is displayed in the grid.
Pls. help me. Thank you in advance.
|
|
|
|
|
Well, I guess you don't have four columns at the point that this code is run. What makes you think that you do ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I already bound the grid with datatable and the result reflect in my datagridview control. And I saw the columns and rows.
Do you mean I need to create set of columns and bind it with datatable?
Thank you very much to your reply.
|
|
|
|
|
No, if you have databound, then you should just have the columns. However, it's clear you do not, that's what the error means. So, you need to work out why, that's what your issue is. Which line blows up ( that is, do you have any columns at all ? )
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I'm using a fairly basic Select statement that is bound to a datagridview )SELECT ID, Desc, Default, Name FROM Table1)
The ID column is an auto-incrementing integer column in Table1. The dataset is strongly typed with commands for insert, delete and update.
Winform setup:
BindingSource1.DataSource = dsData
BindingSource1.DataMember = Table1
Datagridview1.DataSource = BindingSource1
I'm confused on how to properly handle inserts (specifically with the ID column). I'm assuming you would insert the row and return the ID to set the ID column in the grid but am a little lost on what method(s) to use (esp. to cancel the addition in the case the user presses escape). Just looking for a little guidance.
Hope this question makes sense.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Unless I am horribly mistaken (and I have been known to be), the database will handle the ID column for you, as you set it to auto increment.
So the user can just go ahead and update, insert and delete in the datagridview = the dataset, and by simply calling dsData.Update() somewhere / somehow, the changes will actually be made to the database. Up until that point the user is free to change his/her mind.
To prevent problems, you could just set the ID column in the grid to Read Only.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Incase anyone runs into this, SQLCE doesn't support Insert; Select statements from within the tableadapter.insert command text property (as opposed to your standard SQL connections).
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
hello,
im new and i was wondering i can make a browser already:P.
peace off cake you think , no not for me !!
but my question are how can i addinto xml file a link example (google)
so that if i start webrowser and h add a tab with the name google and open google in ther?
i use vb8
hope this is easy for you poeple but not for me
hope a answer. \regard Gerrie
|
|
|
|
|
Yes, this does sound pretty easy. Question is, what are you looking for ? If I wrote the code, how would that help you ? XML is manipulated using XPath and the XMLDocument class. Googling those things will tell you how to work with XML.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
thx for the fast reply,
if i have the first setup for exampel
i use 6 a 7 intranet programs for working around my projects .
i need a browser. where only buttons such as home refresh .
and tab options that i can add in the xml.
[TabNAME]
Naam01= google
naam02= diagnostics
[TabURL]
URL01=http://google.php
URL02=https://anormalurl/opt/
if i start a browser only that 2 tabs are visable.
not needing more.
can you help??
|
|
|
|
|
Hi friends,
We are getting the following error while trying to decrypt the string which is encrypted using the same class.
"Padding is invalid and cannot be removed"
following is the class: (VB.NET)
Imports System
Imports System.IO
Imports System.Security.Cryptography
Public Class EncryptDecrypt
Dim key() As Byte
Dim iv() As Byte
Dim firstRJ As RijndaelManaged
Sub EncryptDecrypt()
Me.InitializeKeyIV()
End Sub
Sub InitializeKeyIV()
key = New Byte() {229, 249, 126, 70, 196, 148, 231, 10, 130, 22, 65, 172, 216, 13, 68, 234, 46, 146, 31, 102, 228, 181, 212, 145}
iv = New Byte() {8, 14, 130, 251, 155, 125, 219, 144, 103, 182, 95, 103, 58, 6, 205, 161}
End Sub
Public Function Encrypt(ByVal clearText) As String
Dim retChiperText As String = ""
If clearText <> "" Then
Dim ms As MemoryStream = Nothing
Dim cs As CryptoStream = Nothing
Dim sw As StreamWriter = Nothing
Try
ms = New MemoryStream()
firstRJ = New RijndaelManaged()
Dim encryptor As ICryptoTransform = firstRJ.CreateEncryptor(key, iv)
cs = New CryptoStream(ms, encryptor, CryptoStreamMode.Write)
sw = New StreamWriter(cs)
sw.Write(clearText)
sw.Close()
Dim chiperTextBytes As Byte()
chiperTextBytes = ms.ToArray()
retChiperText = Convert.ToBase64String(chiperTextBytes)
Catch Ex As Exception
Finally
cs.Close()
ms.Close()
firstRJ.Clear()
End Try
End If
Encrypt = retChiperText
End Function
Public Function Decrypt(ByVal chiperText) As String
Dim retClearText As String = ""
chiperText = Trim(chiperText)
MessageBox.Show("Text: " + chiperText)
If chiperText <> "" Then
Dim cs2 As CryptoStream = Nothing
Dim ms2 As MemoryStream = Nothing
Dim sr As StreamReader = Nothing
Try
Dim chText As Byte()
chText = Convert.FromBase64String(chiperText)
firstRJ = New RijndaelManaged()
ms2 = New MemoryStream(chText)
Dim decryptor As ICryptoTransform = firstRJ.CreateDecryptor(key, iv)
cs2 = New CryptoStream(ms2, decryptor, CryptoStreamMode.Read)
sr = New StreamReader(cs2)
retClearText = sr.ReadLine()
sr.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
cs2.Flush()
cs2.Close()
ms2.Close()
firstRJ.Clear()
'secRJ.Clear()
End Try
End If
Decrypt = retClearText
End Function
End Class
If we instantiate this class in another class the try to decrypt the value, we are getting the above error. Otherwise, if we try to use the decrypt function from the same class it is working fine.
Any ideas on this issue?
Thank you in advance
|
|
|
|
|
It would appear that whatever you're doing to the crypted stream afterwards is altering the data in the stream, or adding something to it.
|
|
|
|
|
hi. Thanks for previous replies.
I have registered control under Administrator privileges on window xp OS. My application use that control and it works fine.
I use check if ocx control registered on machine then run otherwise show appropriate message.
Now I have guest account (limited privileges) and I am unable to read/write registry values. So my application found no control registered and loads nothing.
I want my application to show ocx control because it is already registered by administrator.
Please tell me how can I access registered controls.
Also tell can I use COM components in this regard?
|
|
|
|
|
I already told you, the only way to can find out if the control is registered is to NOT use the designer to drop the control on the form. You can only see if the control is registered if you use CreateObject to try and create an instance of the control. You can catch the error by running the CreateObject code right after an On Error Resume Next line and checking for the value of Err.Number.
|
|
|
|
|
Respected replier.
I am using RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) to open registry key and check whether control is registered or not.
Problem is that when I open registry from guest account I always get 5 return code instead of SUCCESS 0.
Thank you.
|
|
|
|
|
I already told you, in your other post, that the Guest account has no rights to anything. The only part of the registry it can read in under CURRENT_USER, which won't have the component registration info.
|
|
|
|
|
Ditto to Dave, quit asking the same question every day. If you need additional help, reply to your previous post.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I have function 'startthread' that points to the thread 'thread1' which is started when I click on button1.
When i click on button2,it is supposed to stop the thread.I want to restart the thread1 but when i click on button 2 again it gives ThreadStateException saying 'Thread is running or terminated; it cannot restart'
What am i doing wrong here?
''To Start the thread
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ds1 As New DataSet
Dim i As Integer = 0
ds1 = clsDB.getData("Select * from Readers_test")
Dim s As String = ds1.Tables(0).Rows(0)("Reader_Name").ToString + ":" + ds1.Tables(0).Rows(0)("IP_Address").ToString + ":" + ds1.Tables(0).Rows(0)("Port_No").ToString
'thread1.IsBackground = True
thread1.Start(s) ''I get exceptio here when I try to restart the thread
End Sub
''To Stop the thread
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
api.TcpCloseConnect()
If thread1.IsAlive Then
thread1.Abort()
End If
setValue(Me.TextBox3, "Stopped")
End Sub
Private Sub startthread(ByVal state As Object)
Dim timer1 As New System.Timers.Timer
AddHandler timer1.Elapsed, AddressOf scan
Dim st As String = state
Dim status As Integer = 2
Dim param_arr() As String = st.Split(":")
Dim Location As String = param_arr(0)
Dim ReaderIP As String = param_arr(1)
Dim Port As String = param_arr(2)
Dim ReaderPort As Integer = Integer.Parse(param_arr(2))
status = api.TcpConnectReader(ReaderIP, ReaderPort)
If status = 0 Then
setValue(Me.TextBox1, "Connected")
api.ClearIdBuf()
timer1.Interval = 1000
loc = Location
clearbuf = 0
timer1.Start()
Else
setValue(Me.TextBox1, "Not Connected")
End If
End Sub
Public Sub scan(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
Dim status As Integer = 2
Dim i As Integer, j As Integer
Dim IsoBuf As Byte(,) = New Byte(99, 13) {}
Dim tag_cnt As Byte = 0
Dim s As String = ""
Dim s1 As String = ""
Dim antno As Integer = 5
Dim tagstatus As String = ""
Dim tag_flag As Byte = 0
Dim membank, wordptr, wordcnt As Integer
membank = 1
wordptr = 2
wordcnt = 6
'Dim value As Byte() = New Byte(15) {}
Try
status = api.EpcMultiTagIdentify(IsoBuf, tag_cnt, tag_flag)
'If status1 = 0 Then
If tag_cnt > 0 Then
For i = 0 To tag_cnt - 1
s1 = String.Format("", TagCnt)
For j = 2 To 13
s = String.Format("{0:X2}", IsoBuf(i, j))
s1 += s
Next
'Next
antno = IsoBuf(i, 1)
clearbuf = clearbuf + 1
setValue(Me.TextBox2, s1)
If clearbuf = 1 Then
api.ClearIdBuf()
clearbuf = 0
End If
Next
End If
TagCnt += 1
Catch ex As Exception
'MessageBox.Show(ex.ToString)
End Try
End Sub
|
|
|
|
|
If you want to pause and then continue a thread use YourThread.Suspend and YourThread.Resume
My advice is free, and you may get what you paid for.
|
|
|
|
|
You could also create a new instance of the thread just before starting it.
Hope that helps,
-Ray
|
|
|
|
|