|
now, I want to delete one record on datagrid when I checked checkbox.
there is a checkbox on datagrid.
for example; if I checked checkbox on second row. The second row will deleted.(button click event)
how can i do this...
|
|
|
|
|
Did you try searching google first?
If so you may have found this[^].
I don't know how are you binding the grid with the data but as a simple solution, I would say just a do a postback when the checkbox is checked and use the RemoveAt method of DataRowCollection.
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
hi,
am working in .net 2005 with c# coding.am a fresher.
i need javascript for validating the empty textbox. and also how to call the javascript in source code.
if anybody know the script.
plz help me.
thanks®ards,
vinoth.T
|
|
|
|
|
vinothtamilarasan wrote: i need javascript for validating the empty textbox.
I think you need this[^] more than the textbox validation script. You should get familiar with the JavaScript first rather than asking for the solution directly.
Be careful, there is no Undo Button(Ctrl+Z) in life.
|
|
|
|
|
You can use something like this-
function validateEmpty(fld) {
var error = "";
if (fld.value.length == 0) {
fld.style.background = 'Yellow';
error = "The required field has not been filled in.\n"
}
else {
fld.style.background = 'White';
}
return error;
}
function validateFormOnSubmit(theForm) {
var reason = "";
reason += validateEmpty(theForm.field1);
reason += validateEmpty(theForm.field2);
reason += validateEmpty(theForm.field3);
if (reason != "") {
alert("Some fields need correction:\n" + reason);
return false;
}
return true;
}
Replace 'field1', 'field2', and 'field3' with the correct names. You can add and subtract as well. The alert box will output a line delimited list of all error messages. Call the function like this-
<form name="demo" onsubmit="return validateFormOnSubmit(this)" action="action.aspx">
Try that out. Good luck!
Ranjit Viswakumar
Professional Services Specialist
HostMySite.com[^]
|
|
|
|
|
Good day to all ...!!!
Hopefully I can help, I have a problem when working with reflection. I have a dll (called midll.dll) from which all classes have a class named Class1 with their respective attributes. When I try to get an object of this class have to do it by reflection through a Construtor with their parameters (I have stored on the array objects. The array objects called parametersConstructor). Therefore, with the next statement I make this job:
(The parametersConstructor have 2 values)
objObjet2 object = Activator.CreateInstance (assembly.GetType (mydll.Class1 "parametersConstructor); // The assembly is complete
The result is that the object you want to get, and I have no problem, since it does not skip any exceptions to this point.
But the problem is that I realized that one of the attributes of the object is created with one exception. The exception is the following:
atribute4Class1 -> Count = '((System.Collections.Generic.Dictionary <tkey,tvalue>. ValueCollection) (((midll.Class1) (objObjet2)). atribute4Class1)). Count' throw an exception of type 'System.ArgumentException '
Following a little more depth error (it should be noted that there was a lot of where to find the source of the error), what most caught my attention is that at some point I said the following:
Can not find the method of the object instance. (Not specified object that refers)
Personally I thought the problem was with the class, because to say that no method of the object instance, you will most likely have problems with objObjet2 casting that is specified in the original exception.
I thought it was a problem with the class Class1, but discarded, since the same class instance as follows:
Class1 obj = new Class1 ((string) parametersConstructor [0], (string) parametersConstructor [1]);
And the object is created without any problems and even less is not generated except that I mentioned earlier.
Anyone have any idea why this is? Thank you for your help ...!!!
Atte:
Wilson Carchi A.
Software Developer
|
|
|
|
|
Your writing is very difficult to understand.
I suggest you first ensure that the GetType is successful before trying the CreateInstance.
|
|
|
|
|
I can't seem to make the Combobox4 text to reflect the changes made and still pointing to the "Edit..."
Dim mylink As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=" + Application.StartupPath + "\Data\BW.mdb")
If Me.ComboBox4.Text = "Edit..." Then
Dim NewLink As String = InputBox("Type the desired URL to Business Warehouse Inbound", "Business Warehouse SAP")
If NewLink.Length > 0 Then
Dim Outbound As String = "UPDATE _servername SET Outstring ='" + NewLink + "'"
Dim OutFld As OleDb.OleDbCommand = New OleDb.OleDbCommand(Outbound, mylink)
Dim affectedrows As Integer
mylink.Open()
OutFld.Prepare()
affectedrows = OutFld.ExecuteNonQuery()
mylink.Close()
End If
End If
Dim sql As String = "SELECT * FROM _servername" 'Refresh
Dim da = New OleDb.OleDbDataAdapter(sql, mylink)
Dim dtSvr As New Data.DataTable("_servername")
da.Fill(dtSvr)
Me.ComboBox4.Text = (dtSvr.Rows(0).Item("Outstring")).ToString
|
|
|
|
|
Is the combobox's DropDownStyle equal to DropDownEditList . If it is, yuo should change it to DropDown . If that's not the case, use debugger to see that the ComboBox4.Text is set correctly.
Just a sidenote, you should use parameters in your sql commands instead of concatenating.
|
|
|
|
|
The Combobox4.Text shown correctly then afterwards (like refresh) it went to the selected item called "edit..." see my codes
|
|
|
|
|
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_»
|
|
|
|