|
You have to reload it by clearing it, and then running whatever code you loaded it with before. Loading a combobox with database data via a connection doesn't keep that connection open and refresh on its own. You essentially grab a copy of the data and hold onto it on the screen. So if the data changes you have to hit the database again to see the new data.
Hope this helps.
|
|
|
|
|
If you have updated data that is reflected in a ComboBox, then you have to re-fetch that data to get it into the ComboBox. Depending on who you fetched that data and bound the ComboBox to it the first time, all you should need to do is run that code again to re-fetch the new data.
|
|
|
|
|
i am working on word macro in which i have to select few heading1 complete content and paste it into other document.
In the document in every heading 1 i have placed bookmarks for start and end . So how to pick up the text .
Private Sub CommandButton3_Click()
Dim a As String
Dim iCnt As Integer
a = ""
Application.ScreenUpdating = False
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading 1")
Selection.MoveDown Unit:=wdWindow, Count:=1, Extend:=wdExtend
'With ActiveDocument.Select
'With Selection.SetRange Start:=Selection.Start, End:=ActiveDocument.Content.End
Dim Label As String
Do While Selection.Find.Execute
With Selection.Find
fndrepl "<#T"
If .Find.Found Then
iCnt = .MoveEndUntil("#>")
If iCnt = 0 Then
MsgBox "No closing tag found", vbOKOnly, "Error..."
Exit Do
End If
.MoveRight wdCharacter, 2, wdExtend
a = Selection.Text
End If
End With
Loop
End Sub
|
|
|
|
|
how to encrypt the connectionstring tag and other tag wen needed in the appconfig file ..how an app.config file is encrypted.
|
|
|
|
|
You don't encrypt the app.config file. You encrypt the values of your sensitive tags, like a ConnectionString. Read this[^].
|
|
|
|
|
hi all
iam making a project in which i have to read 5v(logic 1) from one pin
of parallel port and then from second pin,then measure the time
interval between them.Then i have a fixed distance and so have to
calculate the speed.
Please help me how to write the code and should i write in vb??.
|
|
|
|
|
Read this[^] little article here on CP. The code is written in C#, but is easily translatable to VB.NET.
|
|
|
|
|
Hi Friends,
Kindly help by giving some guidelines reg. sending mails from Visual Basic 6.0.
Thanks & Regards
|
|
|
|
|
It's simply amazing what you can find with a little application of Google.
"vb6 send email[^]"
|
|
|
|
|
Hi,
Currently I have a textfile with each line of text corresponding to a specific format.
Eg, the first 3 characters is an ID and the next 8 characters is the phone number
XXX12345678
YYY23456789
Are there any classes within .NET that will enable me to input the format for the lines (3 char ID, 8 char number) and parse each line into an array of strings, or better still, an array of objects?
Thanks!
|
|
|
|
|
r u saying u want to put id n the phone number in one field?
|
|
|
|
|
It's more like:
I have a text file, and each line in the file is formatted in a specific way.
In the example I gave, for each line, the first 3 digits is the ID, and the next 8 digits is the phone number. Was wondering if there are any classes that enable me to specify this format and just pass in each string read from the file in a loop so that they can be "tokenized" according to the format.
|
|
|
|
|
i don't know wether this going to help u bcoz i'm not doing a text file. in my case i want a document number in this format = <yyyymmdd><custid><running number="">
so i get this doc number = 20080403abcd0001
the coding would be like this.
cmd.Parameters.Add(New SqlParameter("@docNo", SqlDbType.NVarChar, 50))
cmd.Parameters("@docNo").Value = System.DateTime.Now.ToString("yyyyMMdd") + CustID.Text + GetRunNo().ToString("D4")
sorry if this not going to help u bcoz i'm new in this.
|
|
|
|
|
Stop with the txt speak. You've got a full keyboard in front of your and you're not getting charged by the character to post anything. It's very annoying and making your posts hard to read when you do this.
|
|
|
|
|
You can use regular expressions to parse this kind of thing.
|
|
|
|
|
Thanks, just what I was looking for!
|
|
|
|
|
How to Bind Controls in GridView in VB.Net or C#.Net (Windows Application)
Can any help me to sort out this..
|
|
|
|
|
Hi,
u can do it using below code.
Note: ds means DataSet
If ds.Tables(0).Rows.Count > 0 Then
GridView1.DataSource = ds.Tables(0)
Else
MsgBox("No data found!!", vbCritical + vbOKOnly)
End If
ds.Dispose()
cheers!!!!!!!!!!
regards,
Rana Krishnraj
|
|
|
|
|
Hi Rana,
I want to bind Controls say Textbox in DataGridView by firing the click event of command button
Regds
Krish Vignesh
|
|
|
|
|
|
Hi David
In my project i want to host Textbox in DataGridView.So i wanna to know how to do this
Krish VIgnesh
|
|
|
|
|
OK. Your question really wasn't all that clear, and I'm suspicious of what you really want to do with this.
If I get your intentions, the DataGridView, by default, uses DataGridViewTextBoxColumns to show/edit data. So, I'm not really seeing what the big issue is here.
myDGV.DataSource = myDataTable
|
|
|
|
|
hi, i'm new in this. i want to display a list of data in my data grid view by the date that have been request. example i want a list from 1 feb 2008 untill 20 feb 2008. but nothing come out from the data grid except the title for each column in my datagrid.
so this is the code. or is it something wrong with my datagrid properties
[code]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim startDate As String
Dim endDate As String
Dim ds As DataSet = Nothing
startDate = y1.Text
endDate = y2.Text
Try
Dim cmd As SqlCommand = New SqlCommand("SELECT * FROM Senarai_Log where Date >= '" & startDate & "' and Date <= '" & endDate & "'", New SqlConnection("Server=MAHANI;Database=SPGALatihan;Persist Security Info=True;User ID=sysadm;Password=sysadm"))
cmd.Connection.Open()
Dim sqlDR As SqlDataReader = cmd.ExecuteReader()
DataGrid1.DataSource = sqlDR
DataGrid1.Visible = True
DataGrid1.DataBind()
DataGrid1.DataSource = Nothing
cmd.Connection.Close()
DataGrid1.Visible = True
Catch ex As Exception
ds = Nothing
Label8.Visible = True
Label8.Text = "NO DOKUMEN INI TIADA DALAM REKOD. SILA SEMAK DI DALAM SENARAI LOG"
End Try
End Sub
End Class
[/code]
|
|
|
|
|
zaimah wrote: Dim cmd As SqlCommand = New SqlCommand("SELECT * FROM Senarai_Log where Date >= '" & startDate & "' and Date <= '" & endDate & "'",
It's best that you learn parameterized queries. The reason it doesn't work is because the dates are in the wrong format and your SQL is improperly written.
I highly suggest reading this[^] to understand parameterized queries and what your wrote it a huge security problem.
|
|
|
|
|
thanks dave for giving me the article that r related. but as i said b4, i'm new in this, i didn't understand much about the article except 4 the error msg explaination. in my prgm the user suppose to enter date in this format "dd/mm/yyyy". so, by saying it's in the wrong format is it means that i should not declare it as string? sorry again for my english is not so good. in what way does my code can make injection attacks happen?
|
|
|
|