Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
E

Eunice VB junior

@Eunice VB junior
About
Posts
36
Topics
17
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to kill excel.exe for that particular opened excel in vb.net (window application)
    E Eunice VB junior

    Hi, I try to export datagrid data to one excel spread sheet (i called it ExcelA). Then, when I want to close ExcelA, I wrote this codes to kill excel.exe. wExcel.Quit() System.Runtime.InteropServices.Marshal.ReleaseComObject(wExcel) System.GC.Collect() Dim proc As System.Diagnostics.Process For Each proc In System.Diagnostics.Process.GetProcessesByName("EXCEL") proc.Kill() Next wExcel = Nothing But then, it killed all the excel that I currently open. (those that are not related to this ExcelA.) How can i only kill the excel.exe that belonging to this ExcelA ? Please help. I had tried to search.. but failed to get it. Thanks in advanced. Appreciate your help. :) Here is my codes: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ds.Clear() ds.Tables.Add() If ds.Tables(0).Columns.Count <= 0 Then For i As Integer = 0 To myTable.Columns.Count - 1 ds.Tables(0).Columns.Add(myTable.Columns(i).ColumnName) Next End If Dim dr1 As DataRow For k As Integer = 0 To myTable.Rows.Count - 1 dr1 = ds.Tables(0).NewRow For j As Integer = 0 To myTable.Columns.Count - 1 dr1(j) = dgSearch.Item(k, j) Next ds.Tables(0).Rows.Add(dr1) Next Dim wExcel As New Excel.ApplicationClass Dim wBook As Excel.Workbook Dim wSheet As Excel.Worksheet wBook = wExcel.Workbooks.Add() wSheet = wBook.ActiveSheet() Dim dt As System.Data.DataTable = ds.Tables(0) Dim dc As System.Data.DataColumn Dim dr As System.Data.DataRow Dim colIndex As Integer = 0 Dim rowIndex As Integer = 0 For Each dc In dt.Columns colIndex = colIndex + 1 wExcel.Cells(1, colIndex) = dc.ColumnName Next For Each dr In dt.Rows rowIndex = rowIndex + 1 colIndex = 0 For Each dc In dt.Columns colIndex = colIndex + 1 wExcel.Cells(rowIndex + 1, colIndex) = dr(dc.ColumnName) Next Next wSheet.Columns.AutoFit() Dim strFileName As String = "C:\M2.xls" Dim blnFileOpen As Boolean = False Try Dim fileTemp As System.IO.FileStream = System.IO.File.OpenWrite(strFileName) fileTemp.Close() Catch ex As Exception

    Windows Forms question csharp help tutorial

  • How to Edit specific columns in datagrid in vb.net (window application)?
    E Eunice VB junior

    Hi , I would like to edit 2 columns in datagrid. How can i do that? I know dgSearch.ReadOnly = False, is to be able to edit all columns. But now i only want certain columns only. How should I go about? Please help and guide me. Thanks in advanced. regards, eunice

    Windows Forms tutorial question csharp help

  • gridview unable show without error
    E Eunice VB junior

    Thanks,I understand now... Chris,you are a good 'teacher'. :)

    ASP.NET database help tutorial question announcement

  • gridview unable show without error
    E Eunice VB junior

    Hi Christian Graus, Thank you so much of ur help.. It works brilliant by now... thanks for ur advice as well..

    ASP.NET database help tutorial question announcement

  • gridview unable show without error
    E Eunice VB junior

    The div is visible.I didn't try the empty grid as I'm not too sure how to do it. sorry coz I'm still new to asp.net. I declare the columns at InitMyTable... Sub InitMyTable() myTable = New DataTable("Search") Dim EmpNo As DataColumn = New DataColumn("EmpNo") EmpNo.DataType = System.Type.GetType("System.Int32") myTable.Columns.Add(EmpNo) Dim EmpName As DataColumn = New DataColumn("EmpName") EmpName.DataType = System.Type.GetType("System.String") myTable.Columns.Add(EmpName) Dim ICNo As DataColumn = New DataColumn("ICNo") ICNo.DataType = System.Type.GetType("System.String") myTable.Columns.Add(ICNo) Dim CostCenter As DataColumn = New DataColumn("CostCenter") CostCenter.DataType = System.Type.GetType("System.String") myTable.Columns.Add(CostCenter) Dim Division As DataColumn = New DataColumn("Division") Division.DataType = System.Type.GetType("System.String") myTable.Columns.Add(Division) Dim ds As New DataSet ds = New DataSet ds.Tables.Add(myTable) Me.gvSearch.DataSource = myTable Me.gvSearch.DataBind() End Sub i found one vb code but it's in window application (not asp.net)... it has this extra line :- datagrid1.Update() after the datareader looping... But i'm not too sure how to convert it into asp.net in asp.net, it only has gvSearch.UpdateRow(). But it cannot recognized as well. Please help.... Sorry to trouble you.... Thanks in advanced....

    ASP.NET database help tutorial question announcement

  • gridview unable show without error
    E Eunice VB junior

    below is my gridview setting.. i put the gridview in a div. I tried to create new gridview outside the div also not able to retrieve. and i tried to retrieve to formview also cannot. Pls help me...... Thank you very much.......

    CellPadding="3" CellSpacing="2" Font-Size="Small">

    ASP.NET database help tutorial question announcement

  • gridview unable show without error
    E Eunice VB junior

    Hi Christian Graus, Yes i confirmed that the data is in the table. I tried to put few labels to retrieve the data. (eg:Me.lblEmpNo.Text = dr(1).ToString()) during looping, i can get the correct retrieved result. But it cannot be updated into the gridview after done.... Do i need to write code to update the data from datatable to gridview? How should i solve this problem? Pls help.... Thanks in advanced....

    ASP.NET database help tutorial question announcement

  • gridview unable show without error
    E Eunice VB junior

    Hi ladies and gentlemen, I'm trying to retrieve sql statement to datatable then update to gridview.The datareader can read it. and able to retrieve data to txtDistID(from sql) and lblTotal(total count from datatable). But the gridview cannot show the retrieved value from datareader. but no error message found... Did i miss out anything? Can you please guide me? Thanks and appreciate...... Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click eConn = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ToString() Dim cn As New SqlConnection(eConn) Dim cmd As New SqlCommand cn.Open() strQuery = "SELECT DistID,EmpNo,EmpName,ICNo from udtDistributionAdd order by EmpNo" cmd.CommandText = strQuery cmd.Connection = cn dr = cmd.ExecuteReader() InitMyTable() Do While dr.Read Row = myTable.NewRow() Row.Item("EmpNo") = dr(1).ToString() Row.Item("EmpName") = dr(2).ToString() Row.Item("ICNo") = dr(3).ToString() Me.txtDistID.Text = dr(0).ToString() myTable.Rows.Add(Row) Loop Me.lblTotal.Text = myTable.Rows.Count cn.Close() dr.Close() End Sub Public Sub InitMyTable() myTable = New DataTable("Search") Dim EmpNo As DataColumn = New DataColumn("EmpNo") EmpNo.DataType = System.Type.GetType("System.Int32") myTable.Columns.Add(EmpNo) Dim EmpName As DataColumn = New DataColumn("EmpName") EmpName.DataType = System.Type.GetType("System.String") myTable.Columns.Add(EmpName) Dim ICNo As DataColumn = New DataColumn("ICNo") ICNo.DataType = System.Type.GetType("System.String") myTable.Columns.Add(ICNo) Dim ds As New DataSet ds = New DataSet ds.Tables.Add(myTable) Me.gvSearch.DataSource = myTable Me.gvSearch.DataBind() End Sub

    ASP.NET database help tutorial question announcement

  • error "There is already an open DataReader associated with this Command which must be closed 1st."
    E Eunice VB junior

    thanks..... I'm doing it now. :)

    ASP.NET help question database

  • error "There is already an open DataReader associated with this Command which must be closed 1st."
    E Eunice VB junior

    Any hint to overcome the SQL injection attack? Thanks in advanced.....

    ASP.NET help question database

  • error "There is already an open DataReader associated with this Command which must be closed 1st."
    E Eunice VB junior

    Hi ladies and gentlmen, I got this error while doing the transactions insert command in a do loop select command. What I'm trying to do is, 1st to run select command to query filename and filesize (it consists of few results). Then with the retrieved results, rename the filename and insert into another table with the new filename. After that delete it from the original table. But i got this error "There is already an open DataReader associated with this Command which must be closed 1st". How can i overcome this?can anyone help me on this? I'm out of ideas. Thanks and appreciate... Here is my code:- cmd.Connection = cn cn.Open() tn = cn.BeginTransaction cmd.Transaction = tn strQuery2 = "SELECT FileName,FileSize FROM udtTempAttach where UniqueID = '" & Me.lblUniqueID.Text & "'" cmd.CommandText = strQuery2 dr2 = cmd.ExecuteReader Try Do While dr2.Read filename = Replace(dr2(0).ToString, ".", "_" & DistID & ".") filesize = dr2(1).ToString FileIO.FileSystem.CopyFile(ServerPath + "TempAttach\" + dr2(0).ToString, ServerPath + "Attachment\" + filename, True) If FileIO.FileSystem.FileExists(ServerPath + "Attachment\" + filename) Then FileIO.FileSystem.DeleteFile(ServerPath + "TempAttach\" + dr2(0).ToString) End If strQuery3 = "INSERT udtAttachment (DistID,FileName,FileSize,EnterDate) " strQuery3 = strQuery3 & " values('" & DistID.ToString & "','" & filename.ToString & "','" & filesize.ToString & "',getdate()) " cmd.CommandText = strQuery3 ra = cmd.ExecuteNonQuery() strQuery3 = "Delete from udtTempAttach where UniqueID='" & Me.lblUniqueID.Text & "' and filename = '" & dr2(0).ToString & "'" cmd.CommandText = strQuery3 ra = cmd.ExecuteNonQuery() Loop dr2.Close() Catch ex As Exception MsgBox(ex.Message) dr2.Close() tn.Rollback() Finally If cn.State = ConnectionState.Open Then cn.Close() End Try .......Thanks.......

    ASP.NET help question database

  • The sqlcommand is currently busy open, fetching
    E Eunice VB junior

    Hi, I'm trying to create a transaction code within a button click by performing the insert/update/select. Purpose is to make sure every operation can be rollback instead of some table inserted but some not. But I get this error: The SqlCommand is currently busy Open, Fetching. Description: "System.InvalidoperationException. The sqlCommand is currently busy open,Fetching." It happened at "cmd.ExecuteNonQuery()" (the insert command after select command). Line 52 from my codes. Here is my codes. Can anyone help me? Thanks a lot. Dim cn As New SqlClient.SqlConnection cn.ConnectionString = ("server=samtest;uid=sa;pwd=sa;database=Test") Dim cmd As New SqlClient.SqlCommand Dim tn As SqlClient.SqlTransaction Try cmd.Connection = cn If cn.State = ConnectionState.Closed Then cn.Open() tn = cn.BeginTransaction cmd.Transaction = tn j = 0 For j = 0 To jcounter - 1 Dim DefID As Object = dgItem.Item(j, 0) Dim Component As Object = dgItem.Item(j, 1) Dim QtyOut As Object = dgItem.Item(j, 3) Dim FailQty As Object = dgItem.Item(j, 4) Dim Type As Object = dgItem.Item(j, 5) cmd.CommandText = "Insert into LCDTest (UnitID,TestDefID,Component,PassQty,FailQty,Type) values(" & lblUnitID.Text & "," & DefID.ToString() & ",'" & Component.ToString() & "'," & QtyOut.ToString() & "," & FailQty.ToString() & ",'" & Type.ToString() & "')" cmd.ExecuteNonQuery() Next If icounter > 0 Then i = 0 For i = 0 To icounter - 1 Dim DefID As Object = dgResult.Item(i, 0) Dim Component As Object = dgResult.Item(i, 1) Dim FailureCode As Object = dgResult.Item(i, 2) Dim RejQty As Object = dgResult.Item(i, 3) Dim Remark As Object = dgResult.Item(i, 4) cmd.CommandText = "Select ID from LCDTest WHERE UnitID = " & lblUnitID.Text & " and stationid=" & Me.lblStationID.Text & " and TestDefID =" & DefID.ToString() & " " dr = cmd.ExecuteReader() If dr.Read() Then lblTestID.Text = dr(0).ToString() Else MessageBox.Show("No such ID. Please scan again.") lblTestID.Focus() Exit Sub

    Visual Basic help database sysadmin question announcement

  • How to add button in window form datagrid
    E Eunice VB junior

    Hi Dave, I'm using DataGrid (.net 1.1) version, for vb.net window application. It doesn't have "DataGridButtonColumn" control. How can i add the button column in datagrid. Pls guide me. Thanks.

    Visual Basic help tutorial question

  • How to add button in window form datagrid
    E Eunice VB junior

    Hi, I would like to add a button column on each row in datagrid. How should i do it? I searched the forum from google. The codes look like this: - ' Set datagrid XP Style Button ColumnStyle for City field .Add(New DataGridXPButtonColumn(SystemColors.ControlText, SystemColors.Control)) ' Also you may set datagrid Button ColumnStyle for City ' field without XP Button Style as the following: ' .Add(New DataGridButtonColumn()) With .Item(3) .MappingName = "City" .HeaderText = "City" .Width = 60 .NullText = String.Empty End With But the problem that I'm facing is, i can't add "New DataGridXPButtonColumn" or "New DataGridButtonColumn" in datagridtablestyle. There is no "datagridbuttoncolum" for me to add. It's not allow for me to do so. How should i do? Pls help..... thanks in advance. regards, eunice

    Visual Basic help tutorial question

  • A domain error occurred in SQL
    E Eunice VB junior

    It contains zero value. But don't have -ve value. How can i multiply all data when there is zero value? still convert(float,exp(sum(log(yield)))) ?? Can you please help to guide me? Thanks.

    Database help database tutorial question

  • A domain error occurred in SQL
    E Eunice VB junior

    Hi, I'm facing this problem which i don't know how to solve it. Can anyone guide me? I have a list of data in table @tmp1. Format like below. This table consists > 100 rows of data. Format: PartID PartNumber Yield 866 A100 0.98154735437972429 866 A100 0.9997734994337486 866 A100 0.99168797953964194 868 A200 0.70783730158730163 868 A200 0.99929971988795518 868 A200 0.99889908256880733 When i run this query, select partid,partnumber,convert(float,exp(sum(log(yield)))) from @tmp1 group by partid,partnumber Error encountered.Error message is "A domain error occurred". I'm trying to multiply all data from 'Yield' column. That's why i query with convert(float,exp(sum(log(yield)))) But I suspect convert(float,exp(sum(log(yield)))) is giving the error. So I tried to change datatype to int or varchar or decimal. But still cannot be solved. Pls help me. Thanks in advance.

    Database help database tutorial question

  • error-cannot check the checkbox in datagrid after 2nd search
    E Eunice VB junior

    Hi, I have a datatable retrieve data in a datagrid with a checkbox column bounded to it. On the 1st data retrieval on datagrid, I'm able to check the checkbox. But if i click search to have 2nd data retrieval on datagrind, I'm unable to check the checkbox. Below is my code, i hope someone can guide me to solve this. Private selectedRows As ArrayList Private Sub dgResult_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Dim hit As DataGrid.HitTestInfo = dgResult.HitTest(e.X, e.Y) If hit.Column = 0 AndAlso hit.Type = DataGrid.HitTestType.Cell Then dgResult(hit.Row, hit.Column) = Not CBool(dgResult(hit.Row, hit.Column)) If CBool(dgResult(hit.Row, hit.Column)) Then selectedRows.Add(hit.Row) dgResult.[Select](hit.Row) Else selectedRows.Remove(hit.Row) End If End If End Sub I did run step by step to check the error. When the 2nd retrieval, it run through the codes twice. 1st, it run Private Sub dgResult_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) If hit.Column = 0 AndAlso hit.Type = DataGrid.HitTestType.Cell Then dgResult(hit.Row, hit.Column) = Not CBool(dgResult(hit.Row, hit.Column)) If CBool(dgResult(hit.Row, hit.Column)) Then selectedRows.Add(hit.Row) dgResult.[Select](hit.Row) end if end sub then continue to run it again but this time to remove the check. Private Sub dgResult_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) If hit.Column = 0 AndAlso hit.Type = DataGrid.HitTestType.Cell Then dgResult(hit.Row, hit.Column) = Not CBool(dgResult(hit.Row, hit.Column)) If CBool(dgResult(hit.Row, hit.Column)) Then selectedRows.Remove(hit.Row) end if end sub So, it seems i cannot check. But in actual, it added the check and removed the check at the same time. Can anyone help me? Thanks. eunice

    Visual Basic help tutorial question

  • check all checkbox in datagrid window form
    E Eunice VB junior

    Hi Karl, Thanks for the sharing. But in window form it doesn't have DataGridViewCellMouseEventArgs. What shall I change it to? Appreciate your help again. Thanks. cheers,eunice

    Visual Basic csharp javascript help tutorial

  • check all checkbox in datagrid window form
    E Eunice VB junior

    Hi, I have a datagrid and a checkbox template column is bounded to it on the 1st column. I want to check/uncheck all the checkboxes at once when user click the check/uncheck checkbox in the header template. I got the all the sample codes in Javascript and asp. But not for vb.net window application. Can anyone guide me the codes on window application? It would be grateful if you already have the reference and send it to me. Thanks a lot for ur help.

    Visual Basic csharp javascript help tutorial

  • How to insert multiple rows from datagrid where checkbox is selected?
    E Eunice VB junior

    Hi Allen, Thanks for the tips. But how can i loop through? Is it something like this? For i = 0 To icounter - 1 If myTable.Rows(0).Item("check") = True Then Dim RawID As Object = dgResult.Item(i, 2) Dim Question As Object = dgResult.Item(i, 3) strQuery = "Insert into udtInsert (RawID,Question) values(" & RawID.ToString() & ",'" & Question.ToString() & "' )" conn.Open() cmd.CommandText = strQuery cmd.Connection = conn End If Next pls advice... thanks a lot. cheers,eunice

    Visual Basic question csharp asp-net database
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups