|
So do you mean that after executing this line:
Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString
the text in combobox is something else than "Edit..."? If so, when does it change back to "Edit..."?
|
|
|
|
|
I don't know. I even tried to combobox4.Items.Empty() and that would not do anything to make the Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString
|
|
|
|
|
Is the combobox bound to a datasource?
Also instead of changing the text, you should try to set the selectedindex. If the text isn't already in the combobox list you can add it through Items collection (or by refreshing bindings if the list comes from a datasource).
|
|
|
|
|
This is triggered the Combobox4 prior to clicking the dropdown box and pick "Edit..." If edit is picked than the other code kicks in. Does the Combobox look bounded here?
Dim mylink As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Application.StartupPath + "\Data\BW.mdb")
Dim sql As String
Dim da As OleDb.OleDbDataAdapter
Dim cmd As OleDb.OleDbCommand
Dim objCmd As New OleDb.OleDbCommand
Dim ds As New DataSet
Dim affectedRows As Integer
sql = "SELECT * FROM _servername" 'Reading the all the fields from the MDB file
da = New OleDb.OleDbDataAdapter(sql, mylink)
Dim dtSvr As New Data.DataTable("_servername")
da.Fill(dtSvr)
Me.ComboBox3.Text = dtSvr.Rows(0).Item("Instring")
Me.ComboBox4.Text = dtSvr.Rows(0).Item("Outstring")
Me.Panel2.BringToFront()
Me.ComboBox3.Items.Add("Edit...")
Me.ComboBox4.Items.Add("Edit...")
|
|
|
|
|
No it's not bound based on this, but if you have set the DataSource property in designer it is bound in code-behind file.
However, since you have code on several event handlers, I suggest that you put a breakpoint in every eventhandler where combobox4 is modified whether the eventhandler is for combobox4 or another object. When debugging the debugger should hit your breakpoint(s) and give you more info how/why the text is modifed. Perhaps the events are raised in different order than you expect or some code is called, which "resets" that combo.
|
|
|
|
|
How Export to MS Word form MS access database or Datagridview
|
|
|
|
|
Create a report in MSAccess, open it, and export it as RTF
I are troll
|
|
|
|
|
But I want to make this in VB.NET 2008 and when click button
|
|
|
|
|
put the code in the button_click event
|
|
|
|
|
What's the code I know that put the code
|
|
|
|
|
OK I put the code, code is
Private Sub Export_Word()
Dim oWord As Word.Application
Dim oDoc As Word.Document
oWord = New Word.Application
oDoc = New Word.Document
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add
oDoc.ActiveWindow.Selection.Tables.Add(Range:=oDoc.ActiveWindow.Selection.Range, NumRows:=DataGridView1.RowCount, NumColumns:=3)
'numcolumns:= has to be customized
'Create headers
oDoc.Tables(1).Columns(1).Cells(1).Range.Text = "Име на работник"
oDoc.Tables(1).Columns(1).Cells(1).Range.Font.Bold = True
oDoc.Tables(1).Columns(1).Cells(1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
oDoc.Tables(1).Columns(1).Width = 220
oDoc.Tables(1).Columns(2).Cells(1).Range.Text = "Обект"
oDoc.Tables(1).Columns(2).Cells(1).Range.Font.Bold = True
oDoc.Tables(1).Columns(2).Cells(1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
oDoc.Tables(1).Columns(3).Cells(1).Range.Text = "Дата на работа"
oDoc.Tables(1).Columns(3).Cells(1).Range.Font.Bold = True
oDoc.Tables(1).Columns(3).Cells(1).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
oDoc.Tables(1).Columns(3).Width = 80
'etc.
Dim i As Integer
'Export data
i = 2
oDoc.Tables(1).Columns(1).Cells.Add()
For Each row In DataGridView1.Rows
oDoc.Tables(1).Columns(1).Cells(i).Range.Text = row.Cells(0).Value
oDoc.Tables(1).Columns(2).Cells(i).Range.Text = row.Cells(1).Value
oDoc.Tables(1).Columns(3).Cells(i).Range.Text = row.Cells(2).Value
'etc.
i = i + 1
Next
End Sub
|
|
|
|
|
Hello,
I want to find the harddisk serial number,(not volume serial) using VB.net
CAn anyone guide me or give some link for help,
Any help would be appreciated.
Thank You.
|
|
|
|
|
|
Thanks For your reply,
I have found a code in VB which when run in Administrator Login works perfectly and gives me the Serial No.
But when i run the same code under normal or Limited User, The code does not give the Serial No.
I have gone through the code to find the difference, this is where i found the difference,
SmartOpen = CreateFile("\\.\PhysicalDrive" & CStr(drvNumber), _
GENERIC_READ Or GENERIC_WRITE, _
FILE_SHARE_READ Or FILE_SHARE_WRITE, _
ByVal 0&, _
OPEN_EXISTING, _
0&, _
0&)
The CreateFile function returns a value >0 in Admin Mode but in User Mode it returns -1.
Can any one please tell me what exactly is happening in the above code and what does this CreateFile Function do.
Please , it's Urgent.
Thanks in Advance,
|
|
|
|
|
CreateFile is a Windows API that is used to open several kinds of devices like files, folders, COM ports, pipes, mailslots etc.
It can also open a physical disk drive or volume like in the example you have posted.
The MSDN documentation for CreateFile clearly states that opening a physical disk is dangerous and will require administrative privileges.
Check the Physical Disks and Volumes section in the following link
http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx[^]
«_Superman_»
|
|
|
|
|
Hi,
I discovered the same stuff a year ago when I started using Vista.
In short:
- in order to get the drive serial number you need low-level access to it, i.e. a CreateFile
- although reading some properties is all you need, Vista will not allow you to do so when not running
as administrator. (Try dropping the GENERIC_WRITE).
IMO there is no way around it, disk serial numbers are no longer available to regular users!
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
We have a VS 2003 solution containing 1 vb project and several c# projects. The problem is when i try to build the vb project either VS exits or stuck at "performing main compilation". Please help
|
|
|
|
|
i want to validate the check box present inside the datagrid...
checked or not...
asp.net using c#
foreach (DataGridItem i in DataGrid1 .Items )
{
CheckBox chk = (CheckBox)i.FindControl ("chkbox");
if (chk.Checked )
{
}
}
// i use this to code to add checkbox in data grid
<asp:templatecolumn headertext="Approve" xmlns:asp="#unknown">
<itemtemplate>
<asp:checkbox id="chkbox" runat="server">
if u not able to understand my question plz ask me i will explain..
it is not working properly..
|
|
|
|
|
|
I'm looking for decent article/tutorial demonstrating how to use XmlTextReader to read XML into a (large) object tree. So far the articles are only showing a simple while (reader.Read()) { bla; } loop.
Anyone ever used XmlTextReader to do some serious parsing? Otherwise I'll just go with the XmlDocument thing, that seems to be a lot easier, but I'm curious if anyone has a nice real world usage pattern for XmlTextReader.
Wout
|
|
|
|
|
wout de zeeuw wrote: demonstrating how to use XmlTextReader to read XML into a (large) object tree
wout de zeeuw wrote: Otherwise I'll just go with the XmlDocument thing
The XmlDocument thing is an object tree so why wouldn't you just use it anyway?
|
|
|
|
|
Well, XmlDocument is the easier choice I agree. But if one were to use XmlTextReader to do it, how would that be done typically. I'm just curious if there's a standard way of handling this. I've experimented a bit with XmlTextReader, and I can get things working, but the end result of how I do it feels a bit kludgy.
Wout
|
|
|
|
|
XMLDocument is using a reader internally. You can use reflector to see how reader is used inside that. I think that will help you to understand the usage.
|
|
|
|
|
Nah, XmlDocument builds something generic, but the idea is to parse into a type safe tree of classes. But thanks for the suggestion anyway.
Wout
|
|
|
|
|
wout de zeeuw wrote: but the idea is to parse into a type safe tree of classes
Um, wouldn't that be Serialization?
|
|
|
|