Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

101 Visual Basic and C# Code Samples for Visual Studio .Net

Status
Not open for further replies.
Boss, mukang ayaw na po ng link hehe pwede po mag request? Pa re-upload naman po hihihi. Thank you šŸ˜Š
 
pahelp naman po ng sa prob ko. gusto ko sana magkaron ng export function kaso hindi sumasama yun first row sa export function below

' Creating a Excel object.
Dim excel As Microsoft.Office.Interop.Excel._Application = New Microsoft.Office.Interop.Excel.Application()
Dim workbook As Microsoft.Office.Interop.Excel._Workbook = excel.Workbooks.Add(Type.Missing)
Dim worksheet As Microsoft.Office.Interop.Excel._Worksheet = Nothing

Try

worksheet = workbook.ActiveSheet

worksheet.Name = "ExportedFromDatGrid"

Dim cellRowIndex As Integer = 1
Dim cellColumnIndex As Integer = 1

'Loop through each row and read value from each column.
For i As Integer = 0 To DataGridView2.Rows.Count - 2
For j As Integer = 0 To DataGridView2.Columns.Count - 1
' Excel index starts from 1,1. As first Row would have the Column headers, adding a condition check.
If cellRowIndex = 1 Then
worksheet.Cells(cellRowIndex, cellColumnIndex) = DataGridView2.Columns(j).HeaderText
Else
worksheet.Cells(cellRowIndex, cellColumnIndex) = DataGridView2.Rows(i).Cells(j).Value.ToString()
End If
cellColumnIndex += 1
Next
cellColumnIndex = 1
cellRowIndex += 1
Next

'Getting the location and file name of the excel to save from user.
Dim saveDialog As New SaveFileDialog()
saveDialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"
saveDialog.FilterIndex = 2

If saveDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
workbook.SaveAs(saveDialog.FileName)
MessageBox.Show("Export Successful")
End If
Catch ex As System.Exception
MessageBox.Show(ex.Message)
Finally
excel.Quit()
workbook = Nothing
excel = Nothing
End Try
 
pahelp naman po ng sa prob ko. gusto ko sana magkaron ng export function kaso hindi sumasama yun first row sa export function below

' Creating a Excel object.
Dim excel As Microsoft.Office.Interop.Excel._Application = New Microsoft.Office.Interop.Excel.Application()
Dim workbook As Microsoft.Office.Interop.Excel._Workbook = excel.Workbooks.Add(Type.Missing)
Dim worksheet As Microsoft.Office.Interop.Excel._Worksheet = Nothing

Try

worksheet = workbook.ActiveSheet

worksheet.Name = "ExportedFromDatGrid"

Dim cellRowIndex As Integer = 1
Dim cellColumnIndex As Integer = 1

'Loop through each row and read value from each column.
For i As Integer = 0 To DataGridView2.Rows.Count - 2
For j As Integer = 0 To DataGridView2.Columns.Count - 1
' Excel index starts from 1,1. As first Row would have the Column headers, adding a condition check.
If cellRowIndex = 1 Then
worksheet.Cells(cellRowIndex, cellColumnIndex) = DataGridView2.Columns(j).HeaderText
Else
worksheet.Cells(cellRowIndex, cellColumnIndex) = DataGridView2.Rows(i).Cells(j).Value.ToString()
End If
cellColumnIndex += 1
Next
cellColumnIndex = 1
cellRowIndex += 1
Next

'Getting the location and file name of the excel to save from user.
Dim saveDialog As New SaveFileDialog()
saveDialog.Filter = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*"
saveDialog.FilterIndex = 2

If saveDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
workbook.SaveAs(saveDialog.FileName)
MessageBox.Show("Export Successful")
End If
Catch ex As System.Exception
MessageBox.Show(ex.Message)
Finally
excel.Quit()
workbook = Nothing
excel = Nothing
End Try

dito sa part na to

Dim cellRowIndex As Integer = 1
Dim cellColumnIndex As Integer = 1

gawin mo 0
 
thanks po dito pero eto lumalabas na errors sakin

Exception from HRESULT:0x800A3EC

baka may iba kayong code para maextract from datagridview to Excel. gamit ko po SQL server as database
 
Last edited:
Pa help naman po. new lang ako pa C# language sana matulungan niyo po ako..


meron po ako piece nang code na hindi ko po masyado maintindihan..


content = content.RewriteGroup("property_limitation", null);


private static string RewriteGroup(this string s, string pattern, string replacement)
{
return new Regex($"({pattern} = \\{{)[^\\}}]+(\\}})").Replace(s, $"$1{replacement}$2");
}


this makes the "Durability" Null.

property_limitation = {
{
"Durability",
1,
15
}, // removed

{
"Strenght",
1,
50
},
{
"Damage",
1,
50
}
},

what i want to make is new code that makes the " Durability " , " Strength ", "Damage ", null.


property_limitation = {} ; // ganito po sana ung gusto ko ma achieve.


ano pa po ba ung i susuplement ko sa code ?

private static string RewriteNewGroup(???)
{
return new ??
}
 
patambay po dito..

bago lang po ako dito sa pag program ng visual basic.
gamit ko po visual studio 2013
 
Status
Not open for further replies.
Back
Top Bottom