Imports System.Runtime.Serialization Public Class Frm_V20091231_Weather #Region "data Base 변경여부및 적용방법" '''변경된내용을적용한다. Public Overrides Function AcceptChanged() As Boolean bs.EndEdit() Dim BaseDS As DataSet = CType(bs.DataSource, DataSet) Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember) BaseDT.AcceptChanges() Return True End Function '''변경된내용이있다면 취소한다. Public Overrides Function RejectChanged() As Boolean Dim BaseDS As DataSet = CType(bs.DataSource, DataSet) Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember) BaseDT.RejectChanges() Return True End Function '''데이터에변형이있었는가? Public Overrides Function HasChanged() As Boolean bs.EndEdit() Dim BaseDS As DataSet = CType(bs.DataSource, DataSet) Dim BaseDT As DataTable = BaseDS.Tables(bs.DataMember) Dim ChangeDT As DataTable = BaseDT.GetChanges If Not ChangeDT Is Nothing Then Return True Return False End Function '''기본데이터테이블을 반환합니다. Public Function DT() As DataTable Dim BaseDS As DataSet = CType(bs.DataSource, DataSet) Return BaseDS.Tables(bs.DataMember) End Function #End Region Public Sub New(_opentime) ' 이 호출은 디자이너에 필요합니다. InitializeComponent() OpenTime = _opentime ' InitializeComponent() 호출 뒤에 초기화 코드를 추가하십시오. End Sub Private Sub MdiMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed CEnergy.ARINCLASS.SaveLoad_FrmSetting(Me, Me.bs.Position, True) End Sub Private Sub MdiMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown Select Case e.KeyCode Case Keys.F12 End Select End Sub Private Sub MdiMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Show() My.Application.DoEvents() ' Work_msg_timer("잠시만 기다려주세요") 'CEnergy.ARINCLASS.SaveLoad_FrmSetting(Me) '//Weatehr AddHandler DSET1.tbl_weather.TableNewRow, AddressOf AddNewDataRow_Weather AddHandler DSET1.weather_ilsa.TableNewRow, AddressOf AddNewDataRow_Weatherilsa AddHandler DSET1.weather_temp.TableNewRow, AddressOf AddNewDataRow_Weathertemp AddHandler DSET1.weather_supdo.TableNewRow, AddressOf AddNewDataRow_Weathersupdo AddHandler DSET1.weather_cha.TableNewRow, AddressOf AddNewDataRow_WeatherCha AddHandler DSET1.weather_wind.TableNewRow, AddressOf AddNewDataRow_WeatherWind AddHandler DSET1.weather_river.TableNewRow, AddressOf AddNewDataRow_WeatherRiver AddHandler DSET1.weather_water.TableNewRow, AddressOf AddNewDataRow_WeatherWater AddHandler DSET1.weather_group.TableNewRow, AddressOf AddNewDataRow_WeatherGrp AddHandler dvArea1.CellContentClick, AddressOf dv_cellcontclick AddHandler dvArea2.CellContentClick, AddressOf dv_cellcontclick AddHandler dvArea3.CellContentClick, AddressOf dv_cellcontclick Me.bs.DataSource = DSET1 Me.bsw_ilsa.DataSource = DSET1 Me.bsw_supdo.DataSource = DSET1 Me.bsw_temp.DataSource = DSET1 Me.bsw_cha.DataSource = DSET1 Me.bsw_river.DataSource = DSET1 Me.bsw_water.DataSource = DSET1 Me.bsw_wind.DataSource = DSET1 Me.bsWGDep1.DataSource = DSET1 Me.bsWGDep2.DataSource = DSET1 Me.bsWGDep3.DataSource = DSET1 If bsw_water.Count = 0 Then Dim newdr As DS.weather_waterRow = DSET1.weather_water.Newweather_waterRow() newdr.pcode = "0" newdr.code = "0000" DSET1.weather_water.Addweather_waterRow(newdr) DSET1.weather_water.AcceptChanges() End If '//콤보컨트롤 바인딩 Me.bn_all.BindingSource = Me.bs Me.bs = Me.bs Try Me.bs.Position = CEnergy.ARINCLASS.Read_LastPos_Frm(Me) Catch ex As Exception Me.bs.MoveFirst() End Try AddDebug("▲ Form Load") End Sub Sub dv_cellcontclick(sender As Object, e As DataGridViewCellEventArgs) Dim grid As DataGridView = sender If grid.Columns(e.ColumnIndex).DataPropertyName <> "area" Then Return Dim f As New fSelectArea() If f.ShowDialog <> DialogResult.OK Then Return grid.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = f.ComboBox1.Text.ToString() End Sub #Region "Weather 관련" Private Sub AddNewDataRow_WeatherGrp(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) End Sub Private Sub AddNewDataRow_Weather(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) e.Row.Item("code") = GetMaxCode(DSET1.tbl_weather) End Sub Private Sub AddNewDataRow_Weatherilsa(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) If bs.Current Is Nothing Then Return e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code") '//일사데이터는 0001로부터하게한다 Dim Newcode As String Try Dim Dr As DataRow = DSET1.weather_ilsa.Select("pcode='" & e.Row.Item("pcode").ToString & "'", "code desc")(0) Newcode = Format(CInt(Dr("code")) + 1, "0000") Catch ex As Exception Newcode = "0001" End Try e.Row.Item("code") = Newcode End Sub Private Sub AddNewDataRow_Weathertemp(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) If bs.Current Is Nothing Then Return e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code") e.Row.Item("code") = GetMaxCode(DSET1.weather_temp) End Sub Private Sub AddNewDataRow_Weathersupdo(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) If bs.Current Is Nothing Then Return e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code") e.Row.Item("code") = GetMaxCode(DSET1.weather_supdo) End Sub Private Sub AddNewDataRow_WeatherCha(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) If bs.Current Is Nothing Then Return e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code") e.Row.Item("code") = GetMaxCode(DSET1.weather_cha) End Sub Private Sub AddNewDataRow_WeatherWind(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) If bs.Current Is Nothing Then Return e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code") e.Row.Item("code") = GetMaxCode(DSET1.weather_wind) End Sub Private Sub AddNewDataRow_WeatherRiver(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) If bs.Current Is Nothing Then Return e.Row.Item("pcode") = CType(bs.Current, DataRowView)("code") e.Row.Item("code") = GetMaxCode(DSET1.weather_river) End Sub Private Sub AddNewDataRow_WeatherWater(ByVal sender As Object, ByVal e As System.Data.DataTableNewRowEventArgs) e.Row.Item("pcode") = "0" ' CType(bs.Current, DataRowView)("code") e.Row.Item("code") = GetMaxCode(DSET1.weather_water) End Sub Private Function GetMaxCode(ByVal dt As DataTable) As String Try Dim Dr As DataRow = dt.Select("", "code desc")(0) Return Format(CInt(Dr("code")) + 1, "0000") Catch ex As Exception Return "0001" End Try End Function Private Sub bt_add_weather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Not EndEdit(Me.bs) Then Return Me.bs.AddNew() End Sub Private Sub bt_Del_weather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dbbase.DelCrow(Me.bs, True) End Sub Private Sub bt_save_weather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If Not EndEdit(Me.bs) Then Return If Not EndEdit(Me.bsw_supdo) Then Return If Not EndEdit(Me.bsw_ilsa) Then Return If Not EndEdit(Me.bsw_temp) Then Return If Not EndEdit(Me.bsw_cha) Then Return If Not EndEdit(Me.bsw_wind) Then Return If Not EndEdit(Me.bsw_river) Then Return If Not EndEdit(Me.bsw_water) Then Return Check_Modify(Me.DS1.tbl_weather) Check_Modify(Me.DS1.weather_ilsa, False) Check_Modify(Me.DS1.weather_supdo, False) Check_Modify(Me.DS1.weather_temp, False) Check_Modify(Me.DS1.weather_cha, False) Check_Modify(Me.DS1.weather_wind, False) Check_Modify(Me.DS1.weather_river, False) Check_Modify(Me.DS1.weather_water, False) End Sub Private Sub bs_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bs.CurrentChanged If isImport = True Then Return If bs.Current Is Nothing Then Return Dim pcode As String = CType(bs.Current, DataRowView)("code").ToString Me.bsw_ilsa.Filter = "pcode='" & pcode & "'" Me.bsw_temp.Filter = "pcode='" & pcode & "'" Me.bsw_supdo.Filter = "pcode='" & pcode & "'" Me.bsw_cha.Filter = "pcode='" & pcode & "'" Me.bsw_wind.Filter = "pcode='" & pcode & "'" Me.bsw_river.Filter = "pcode='" & pcode & "'" Me.bsw_water.Filter = "" If DSET1.weather_temp.Select("pcode='" & pcode & "'").GetUpperBound(0) = -1 Then For i As Integer = 1 To 12 'MsgBox(i) Dim Dr As DS.weather_tempRow = DSET1.weather_temp.Newweather_tempRow Dr.code = Format(i, "0000") Dr.설명 = Format(i, "00") & "월" DSET1.weather_temp.Addweather_tempRow(Dr) Next Else 'MsgBox(Me.bsw_temp.Count) End If If DSET1.weather_supdo.Select("pcode='" & pcode & "'").GetUpperBound(0) = -1 Then For i As Integer = 1 To 12 Dim Dr As DS.weather_supdoRow = DSET1.weather_supdo.Newweather_supdoRow Dr.code = Format(i, "0000") Dr.설명 = Format(i, "00") & "월" DSET1.weather_supdo.Addweather_supdoRow(Dr) Next Else 'MsgBox(Me.bsw_supdo.Count) End If If DSET1.weather_wind.Select("pcode='" & pcode & "'").GetUpperBound(0) = -1 Then Dim Dr As DS.weather_windRow = DSET1.weather_wind.Newweather_windRow() Dr.code = "0" Dr.설명 = "" DSET1.weather_wind.Addweather_windRow(Dr) Else 'MsgBox(Me.bsw_supdo.Count) End If If DSET1.weather_river.Select("pcode='" & pcode & "'").GetUpperBound(0) = -1 Then Dim Dr As DS.weather_riverRow = DSET1.weather_river.Newweather_riverRow() Dr.code = "0" Dr.설명 = "" DSET1.weather_river.Addweather_riverRow(Dr) Else 'MsgBox(Me.bsw_supdo.Count) End If Me.DS1.weather_temp.AcceptChanges() Me.DS1.weather_supdo.AcceptChanges() Me.DS1.weather_river.AcceptChanges() Me.DS1.weather_wind.AcceptChanges() Me.DS1.weather_water.AcceptChanges() End Sub Private Sub ToolStripButton14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton14.Click If Not EndEdit(Me.bsw_ilsa) Then Return Me.bsw_ilsa.AddNew() End Sub Private Sub ToolStripButton15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton15.Click Dbbase.DelCrow(Me.bsw_ilsa, True) End Sub Private Sub ToolStripButton29_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton29.Click If Not EndEdit(Me.bsw_temp) Then Return Me.bsw_temp.AddNew() End Sub Private Sub ToolStripButton30_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton30.Click Dbbase.DelCrow(Me.bsw_temp, True) End Sub Private Sub ToolStripButton37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton37.Click If Not EndEdit(Me.bsw_supdo) Then Return Me.bsw_supdo.AddNew() End Sub Private Sub ToolStripButton38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton38.Click Dbbase.DelCrow(Me.bsw_supdo, True) End Sub Private Sub ToolStripButton6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click Dbbase.DelCrow(Me.bsw_cha, True) End Sub Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click If Not EndEdit(Me.bsw_cha) Then Return Me.bsw_cha.AddNew() End Sub #End Region Private Sub ToolStripButton48_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton48.Click If Prj.Opened = False Then MsgBox("먼저 파일을 불러오세요", MsgBoxStyle.Information, "확인") Return End If If Not EndEdit(Me.bs) Then Return Me.bs.AddNew() End Sub Private Sub ToolStripButton49_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton49.Click If Prj.Opened = False Then MsgBox("먼저 파일을 불러오세요", MsgBoxStyle.Information, "확인") Return End If Dbbase.DelCrow(Me.bs, True) End Sub Private Sub ToolStripButton51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton51.Click If Prj.Opened = False Then MsgBox("먼저 파일을 불러오세요", MsgBoxStyle.Information, "확인") Return End If If MsgBox("변경된 내용을 취소하시겠습니까?", MsgBoxStyle.Information Or MsgBoxStyle.OkCancel, "변경취소") <> MsgBoxResult.Ok Then Return DSET1.tbl_weather.RejectChanges() DSET1.weather_cha.RejectChanges() DSET1.weather_ilsa.RejectChanges() DSET1.weather_supdo.RejectChanges() DSET1.weather_temp.RejectChanges() DSET1.weather_wind.RejectChanges() DSET1.weather_river.RejectChanges() DSET1.weather_water.RejectChanges() End Sub Private Sub tb_t1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_t1.KeyDown 'If e.KeyCode = Keys.V And e.Control Then ' e.Handled = True ' e.SuppressKeyPress = False ' '//클립보드붙여넣기 ' Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) ' Dim Cnt As Short = 0 ' For i As Integer = 0 To CB.GetUpperBound(0) ' If CB(i).Trim <> "" Then ' If Cnt <> 0 Then ' Dim Ctl As TextBox = CType(Me.TableLayoutPanel3.Controls(Me.TableLayoutPanel3.Controls.IndexOfKey("tb_t" & CStr(Cnt + 1))), TextBox) ' Ctl.Text = CB(i).Trim ' End If ' Cnt = CShort(Cnt + 1) ' End If ' Next 'End If If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 23 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) Dim Cnt As Short = 0 For i As Integer = 0 To CB.GetUpperBound(0) Select Case i Case 0 '//Me.tb_t1.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 1 Me.tb_t2.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 Me.tb_t3.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 Me.tb_t4.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 Me.tb_t5.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 Me.tb_t6.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 Me.tb_t7.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 Me.tb_t8.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 Me.tb_t9.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 Me.tb_t10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 Me.tb_t11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 Me.tb_t12.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 12 Me.tb_t13.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 13 Me.tb_t14.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 14 Me.tb_t15.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 15 Me.tb_t16.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 16 Me.tb_t17.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 17 Me.tb_t18.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 18 Me.tb_t19.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 19 Me.tb_t20.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 20 Me.tb_t21.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 21 Me.tb_t22.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 22 Me.tb_t23.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 23 Me.tb_t24.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next '//If bsw_temp.Position < bsw_temp.Count Then bsw_temp.Position += 1 '//위치이동 Next Me.bsw_temp.EndEdit() End If End Sub Private Sub tb_s1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_s1.KeyDown 'If e.KeyCode = Keys.V And e.Control Then ' e.Handled = True ' e.SuppressKeyPress = False ' '//클립보드붙여넣기 ' Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) ' Dim Cnt As Short = 0 ' For i As Integer = 0 To CB.GetUpperBound(0) ' If CB(i).Trim <> "" Then ' If Cnt <> 0 Then ' Dim Ctl As TextBox = CType(Me.TableLayoutPanel7.Controls(Me.TableLayoutPanel7.Controls.IndexOfKey("tb_s" & CStr(Cnt + 1))), TextBox) ' Ctl.Text = CB(i).Trim ' End If ' Cnt = CShort(Cnt + 1) ' End If ' Next 'End If If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 23 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) Dim Cnt As Short = 0 For i As Integer = 0 To CB.GetUpperBound(0) Select Case i Case 0 '//Me.tb_s1.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 1 Me.tb_s2.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 Me.tb_s3.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 Me.tb_s4.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 Me.tb_s5.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 Me.tb_s6.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 Me.tb_s7.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 Me.tb_s8.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 Me.tb_s9.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 Me.tb_s10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 Me.tb_s11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 Me.tb_S12.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 12 Me.tb_s13.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 13 Me.tb_s14.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 14 Me.tb_s15.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 15 Me.tb_s16.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 16 Me.tb_s17.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 17 Me.tb_s18.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 18 Me.tb_s19.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 19 Me.tb_s20.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 20 Me.tb_s21.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 21 Me.tb_s22.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 22 Me.tb_s23.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 23 Me.tb_s24.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next '//If bsw_supdo.Position < bsw_supdo.Count Then bsw_supdo.Position += 1 '//위치이동 Next Me.bsw_supdo.EndEdit() End If End Sub Private Sub tb_v0_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_v0.KeyDown 'If e.KeyCode = Keys.V And e.Control Then ' '//클립보드붙여넣기 ' Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) ' Dim Cnt As Short = 0 ' For i As Integer = 0 To CB.GetUpperBound(0) ' If CB(i).Trim <> "" Then ' If Cnt <> 0 Then ' Dim Ctl As TextBox = CType(Me.TableLayoutPanel2.Controls(Me.TableLayoutPanel2.Controls.IndexOfKey("tb_v" & CStr(Cnt))), TextBox) ' Ctl.Text = CB(i).Trim ' End If ' Cnt = CShort(Cnt + 1) ' End If ' Next ' e.Handled = True ' e.SuppressKeyPress = False 'End If Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 12 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) 'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가 'MsgBox(CB.GetUpperBound(0)) Dim Cnt As Short = 0 For i As Integer = 0 To CB.GetUpperBound(0) Select Case i Case 0 '///조명은 신규기록하지않으므로.. 쓰지않게한다. '//Me.tb_v0.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 1 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v1.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v2.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v3.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v4.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v5.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v6.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v7.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v8.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v9.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 12 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_v12.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next '// If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동 Next Me.bsw_ilsa.EndEdit() End If End Sub Private Sub Frm_V20091231_Zone_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel If e.Delta < 0 Then If Me.bs.Position < Me.bs.Count Then Me.bs.Position += 1 Else If Me.bs.Position > 0 Then Me.bs.Position -= 1 End If Me.Validate() My.Application.DoEvents() End Sub Private Sub NTb4_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_c01.KeyDown If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 12 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) 'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가 'MsgBox(CB.GetUpperBound(0)) Dim Cnt As Short = 0 For i As Integer = 1 To CB.GetUpperBound(0) Select Case i Case 0 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c01.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 1 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c02.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c03.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c04.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c05.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c06.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c07.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c08.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c09.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_c12.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next '//If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동 Next Me.bsw_cha.EndEdit() End If End Sub Private Sub dv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dv.MouseUp If e.Button = Windows.Forms.MouseButtons.Right Then Dim Frm_FilterA As New Frm_Filter Frm_FilterA.ColumTitle = getColCaption(Me.DT) Frm_FilterA.ColumList = getColName(Me.DT) Frm_FilterA.Colorlist = "" If Frm_FilterA.ShowDialog <> Windows.Forms.DialogResult.OK Then Return '//창떳을떄 확인아ㅣ고 취소눌르면 다음을 수행하지않는다는거에요. Dim Filter As String = Frm_FilterA.tb_filter.Text '//값은 아까 그 텍박에 잇구요. Try Me.bs.Filter = Filter Catch ex As Exception Me.bs.Filter = "" End Try End If End Sub Private Sub 외기온도_난방기_NTb_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tb_wnan.KeyDown If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 14 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) 'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가 'MsgBox(CB.GetUpperBound(0)) Dim Cnt As Short = 0 For i As Integer = 0 To CB.GetUpperBound(0) Select Case i Case 0 '///조명은 신규기록하지않으므로.. 쓰지않게한다. 'Me.tb_wnan.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 1 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_wnaen.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w01.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w02.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w03.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w04.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w05.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w06.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w07.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w08.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w09.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 12 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 13 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tb_w12.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next 'If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동 Next Me.bsw_cha.EndEdit() End If End Sub Private Sub Arindv2_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Arindv2.KeyDown If e.KeyCode = Keys.C AndAlso e.Control Then My.Computer.Clipboard.SetData("ILSAROW", Me.Arindv2.SelectedRows) ElseIf e.KeyCode = Keys.V AndAlso e.Control Then Dim A As DataGridViewSelectedRowCollection = My.Computer.Clipboard.GetData("ILSAROW") For i As Integer = 1 To A.Count Me.ToolStripButton14.PerformClick() '//한줄추가하고 Dim Drv As DataRowView = Me.bsw_ilsa.Current Drv("설명") = A(i).Cells(0).Value Next End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For Each drp As DS.tbl_weatherRow In DSET1.tbl_weather.Rows Dim i As Integer = 0 For Each dr As DS.weather_chaRow In DSET1.weather_cha.Select("pcode='" & drp.code & "'") i += 1 dr.code = Format(i, "0000") Next Next 'For j As Integer = 1 To DSET1.weather_cha.Select(Me.bsw_cha.Filter).Length ' DSET1.weather_cha.Select(Me.bsw_cha.Filter)(j - 1)("code") = Format(j, "0000") 'Next DS1.weather_cha.AcceptChanges() '//이건 변경내역을 반영하게삳는겁니다. End Sub Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click '//save 'AddHandler DSET1.tbl_weather.TableNewRow, AddressOf AddNewDataRow_Weather 'AddHandler DSET1.weather_ilsa.TableNewRow, AddressOf AddNewDataRow_Weatherilsa 'AddHandler DSET1.weather_temp.TableNewRow, AddressOf AddNewDataRow_Weathertemp DSET1.tbl_weather.WriteXml(AppDomain.CurrentDomain.BaseDirectory + "db_weather.xml") DSET1.weather_ilsa.WriteXml(AppDomain.CurrentDomain.BaseDirectory + "db_weather_ilsa.xml") DSET1.weather_temp.WriteXml(AppDomain.CurrentDomain.BaseDirectory + "db_weather_temp.xml") End Sub Dim isImport As Boolean = False Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click If MsgBox("현 자료가 삭제됩니다 실행?", MsgBoxStyle.Question Or MsgBoxStyle.YesNo, "확인") <> MsgBoxResult.Yes Then Return Dim od As New OpenFileDialog od.Filter = "excle|*.xls" od.RestoreDirectory = True If od.ShowDialog() <> Windows.Forms.DialogResult.OK Then Return isImport = True Dim xlApp As Excel.Application = New Excel.Application ' CreateObject("Excel.Application") Dim xlBook As Excel.Workbook = xlApp.Workbooks.Open(od.FileName) Dim xlSheet1 As Excel.Worksheet = xlBook.Worksheets(3) '//첫번째 시트로고정 DSET1.tbl_weather.Clear() DSET1.weather_cha.Clear() DSET1.weather_ilsa.Clear() DSET1.weather_temp.Clear() DSET1.weather_supdo.Clear() DSET1.weather_wind.Clear() DSET1.weather_river.Clear() DSET1.weather_water.Clear() Dim Rng As Excel.Range = xlSheet1.Range("B3") '//Offset으로사용할것이므로 0,0셀을 선택한다 Dim newdr0 As DS.tbl_weatherRow = DSET1.tbl_weather.NewRow newdr0.건물위치 = "없음" newdr0.code = "0" DSET1.tbl_weather.Addtbl_weatherRow(newdr0) '//전체 66개의 지역 For area As Integer = 1 To 66 Dim 지역명 As String = Rng.Offset(0, area - 1).Value Dim 지역코드 As String = area.ToString("0000") Dim newdr As DS.tbl_weatherRow = DSET1.tbl_weather.NewRow newdr.건물위치 = 지역명 newdr.code = 지역코드 newdr.난방기 = Rng.Offset(3, area - 1).Value newdr.냉방기 = Rng.Offset(4, area - 1).Value '//월별 외기평균온도 For i As Integer = 1 To 12 newdr("m" + i.ToString("00")) = Rng.Offset(i + 5, area - 1).Value Next DSET1.tbl_weather.Addtbl_weatherRow(newdr) '//월별 평균일사(수평면) Dim dr일사 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr일사.code = "0001" dr일사.pcode = 지역코드 dr일사.설명 = "수평면" dr일사.최대부하 = Rng.Offset(19, area - 1).Value For i As Integer = 1 To 12 dr일사("m" + i.ToString("00")) = Rng.Offset(20 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr일사) '//월별 평균일사(남향) Dim dr남향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr남향.code = "0002" dr남향.pcode = 지역코드 dr남향.설명 = "남향" dr남향.최대부하 = Rng.Offset(33, area - 1).Value For i As Integer = 1 To 12 dr남향("m" + i.ToString("00")) = Rng.Offset(34 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr남향) '//월별 평균일사(남동향) Dim dr남동향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr남동향.code = "0003" dr남동향.pcode = 지역코드 dr남동향.설명 = "남동향" dr남동향.최대부하 = Rng.Offset(47, area - 1).Value For i As Integer = 1 To 12 dr남동향("m" + i.ToString("00")) = Rng.Offset(48 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr남동향) '//월별 평균일사(남서향) Dim dr남서향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr남서향.code = "0004" dr남서향.pcode = 지역코드 dr남서향.설명 = "남서향" dr남서향.최대부하 = Rng.Offset(61, area - 1).Value For i As Integer = 1 To 12 dr남서향("m" + i.ToString("00")) = Rng.Offset(62 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr남서향) '//월별 평균일사(동향) Dim dr동향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr동향.code = "0005" dr동향.pcode = 지역코드 dr동향.설명 = "동향" dr동향.최대부하 = Rng.Offset(75, area - 1).Value For i As Integer = 1 To 12 dr동향("m" + i.ToString("00")) = Rng.Offset(76 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr동향) '//월별 평균일사(서향) Dim dr서향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr서향.code = "0006" dr서향.pcode = 지역코드 dr서향.설명 = "서향" dr서향.최대부하 = Rng.Offset(89, area - 1).Value For i As Integer = 1 To 12 dr서향("m" + i.ToString("00")) = Rng.Offset(90 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr서향) '//월별 평균일사(북동향) Dim dr북동향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr북동향.code = "0007" dr북동향.pcode = 지역코드 dr북동향.설명 = "북동향" dr북동향.최대부하 = Rng.Offset(103, area - 1).Value For i As Integer = 1 To 12 dr북동향("m" + i.ToString("00")) = Rng.Offset(104 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr북동향) '//월별 평균일사(북서향) Dim dr북서향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr북서향.code = "0008" dr북서향.pcode = 지역코드 dr북서향.설명 = "북서향" dr북서향.최대부하 = Rng.Offset(117, area - 1).Value For i As Integer = 1 To 12 dr북서향("m" + i.ToString("00")) = Rng.Offset(118 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr북서향) '//월별 평균일사(북향) Dim dr북향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr북향.code = "0009" dr북향.pcode = 지역코드 dr북향.설명 = "북향" dr북향.최대부하 = Rng.Offset(131, area - 1).Value For i As Integer = 1 To 12 dr북향("m" + i.ToString("00")) = Rng.Offset(132 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr북향) '//월별 평균일사(45도남향) Dim dr45도남향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr45도남향.code = "0010" dr45도남향.pcode = 지역코드 dr45도남향.설명 = "45도남향" dr45도남향.최대부하 = Rng.Offset(145, area - 1).Value For i As Integer = 1 To 12 dr45도남향("m" + i.ToString("00")) = Rng.Offset(146 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr45도남향) '//월별 평균일사(45도남동향) Dim dr45도남동향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr45도남동향.code = "0011" dr45도남동향.pcode = 지역코드 dr45도남동향.설명 = "45도남동향" dr45도남동향.최대부하 = Rng.Offset(159, area - 1).Value For i As Integer = 1 To 12 dr45도남동향("m" + i.ToString("00")) = Rng.Offset(160 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr45도남동향) '//월별 평균일사(45도남서향) Dim dr45도남서향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr45도남서향.code = "0012" dr45도남서향.pcode = 지역코드 dr45도남서향.설명 = "45도남서향" dr45도남서향.최대부하 = Rng.Offset(173, area - 1).Value For i As Integer = 1 To 12 dr45도남서향("m" + i.ToString("00")) = Rng.Offset(174 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr45도남서향) '//월별 평균일사(45도동향) Dim dr45도동향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr45도동향.code = "0013" dr45도동향.pcode = 지역코드 dr45도동향.설명 = "45도동향" dr45도동향.최대부하 = Rng.Offset(187, area - 1).Value For i As Integer = 1 To 12 dr45도동향("m" + i.ToString("00")) = Rng.Offset(188 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr45도동향) '//월별 평균일사(45도서향) Dim dr45도서향 As DS.weather_ilsaRow = DSET1.weather_ilsa.NewRow dr45도서향.code = "0014" dr45도서향.pcode = 지역코드 dr45도서향.설명 = "45도서향" dr45도서향.최대부하 = Rng.Offset(201, area - 1).Value For i As Integer = 1 To 12 dr45도서향("m" + i.ToString("00")) = Rng.Offset(202 + (i - 1), area - 1).Value Next DSET1.weather_ilsa.Addweather_ilsaRow(dr45도서향) '//월별 평균온도(1) For m As Integer = 1 To 12 Dim offset As Integer = (m - 1) * 25 Dim dr평균온도1월 As DS.weather_tempRow = DSET1.weather_temp.NewRow dr평균온도1월.code = m.ToString("0000") dr평균온도1월.pcode = 지역코드 dr평균온도1월.설명 = m.ToString("00") + "월" For i As Integer = 1 To 24 dr평균온도1월("t" + i.ToString("00")) = Rng.Offset((215 + offset) + (i - 1), area - 1).Value Next DSET1.weather_temp.Addweather_tempRow(dr평균온도1월) Next '//월별 평균습도(1) For m As Integer = 1 To 12 Dim offset As Integer = (m - 1) * 25 Dim dr평균온도1월 As DS.weather_supdoRow = DSET1.weather_supdo.NewRow dr평균온도1월.code = m.ToString("0000") dr평균온도1월.pcode = 지역코드 dr평균온도1월.설명 = m.ToString("00") + "월" For i As Integer = 1 To 24 dr평균온도1월("t" + i.ToString("00")) = Rng.Offset((515 + offset) + (i - 1), area - 1).Value Next DSET1.weather_supdo.Addweather_supdoRow(dr평균온도1월) Next '//차양감소계수 For m As Integer = 1 To 8 Dim offset As Integer = (m - 1) * 13 Dim dr평균온도1월 As DS.weather_chaRow = DSET1.weather_cha.NewRow dr평균온도1월.code = m.ToString("0000") dr평균온도1월.pcode = 지역코드 Select Case m Case 1 dr평균온도1월.설명 = "남향" Case 2 dr평균온도1월.설명 = "남동향" Case 3 dr평균온도1월.설명 = "남서향" Case 4 dr평균온도1월.설명 = "동향" Case 5 dr평균온도1월.설명 = "서향" Case 6 dr평균온도1월.설명 = "북동향" Case 7 dr평균온도1월.설명 = "북서향" Case 8 dr평균온도1월.설명 = "북향" End Select For i As Integer = 1 To 12 dr평균온도1월("m" + i.ToString("00")) = Rng.Offset((815 + offset) + (i - 1), area - 1).Value Next DSET1.weather_cha.Addweather_chaRow(dr평균온도1월) Next Next Work_msg("") '//Dispos Excel Object xlBook.Close() xlApp.Application.Quit() xlApp = Nothing xlBook = Nothing xlSheet1 = Nothing '//update isImport = False '//refresh bs_CurrentChanged(Nothing, Nothing) MsgBox("ok") End Sub Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click '//delete 1dep '//하위모든데이터를 삭제해야한다. Dim drv As DataRowView = Me.bsWGDep1.Current If drv Is Nothing OrElse drv("code").ToString().Length < 6 Then Return Dim codeHeader As String = drv("code").ToString().Substring(0, 2) Dim drows() As DataRow = DSET1.weather_group.Select(String.Format("code like '{0}%'", codeHeader)) For i As Integer = drows.Length To 1 Step -1 DSET1.weather_group.Rows.Remove(drows(i - 1)) Next End Sub Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click '//add 2 '//1번이 선택되지 않앗다면 넘어간다. Dim drv1 As DataRowView = Me.bsWGDep1.Current If drv1 Is Nothing OrElse drv1("code").ToString().Length < 6 Then Return Dim codeHeader As String = drv1("code").ToString().Substring(0, 2) Dim newcode As String = String.Empty For i As Integer = 1 To 99 Dim ccode As String = codeHeader + i.ToString("00") + "00" '//이 코드가 현재 없다면 적용한다. If DSET1.weather_group.Select("code='" + ccode + "'").Length < 1 Then newcode = ccode Exit For End If Next If String.IsNullOrEmpty(newcode) Then MsgBox("신규번호를 할당 하지 못했습니다", MsgBoxStyle.Critical, "확인") Return End If Dim newdr As DS.weather_groupRow = DSET1.weather_group.Newweather_groupRow newdr.code = newcode newdr.name = "<지역명>" DSET1.weather_group.Addweather_groupRow(newdr) End Sub Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click '//delete 2dep '//하위모든데이터를 삭제해야한다. Dim drv As DataRowView = Me.bsWGDep2.Current If drv Is Nothing OrElse drv("code").ToString().Length < 6 Then Return Dim codeHeader As String = drv("code").ToString().Substring(0, 4) Dim drows() As DataRow = DSET1.weather_group.Select(String.Format("code like '{0}%'", codeHeader)) For i As Integer = drows.Length To 1 Step -1 DSET1.weather_group.Rows.Remove(drows(i - 1)) Next End Sub Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click '/add 3 '//2번이 선택되지 않앗다면 넘어간다. Dim drv1 As DataRowView = Me.bsWGDep2.Current If drv1 Is Nothing OrElse drv1("code").ToString().Length < 6 Then Return Dim codeHeader As String = drv1("code").ToString().Substring(0, 4) Dim newcode As String = String.Empty For i As Integer = 1 To 99 Dim ccode As String = codeHeader + i.ToString("00") '//이 코드가 현재 없다면 적용한다. If DSET1.weather_group.Select("code='" + ccode + "'").Length < 1 Then newcode = ccode Exit For End If Next If String.IsNullOrEmpty(newcode) Then MsgBox("신규번호를 할당 하지 못했습니다", MsgBoxStyle.Critical, "확인") Return End If Dim newdr As DS.weather_groupRow = DSET1.weather_group.Newweather_groupRow newdr.code = newcode newdr.name = "<지역명>" DSET1.weather_group.Addweather_groupRow(newdr) End Sub Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click '//delete 3dep Dim drv As DataRowView = Me.bsWGDep3.Current If drv Is Nothing OrElse drv("code").ToString().Length < 6 Then Return Dim codeHeader As String = drv("code").ToString().Substring(0, 6) Dim drows() As DataRow = DSET1.weather_group.Select(String.Format("code like '{0}%'", codeHeader)) For i As Integer = drows.Length To 1 Step -1 DSET1.weather_group.Rows.Remove(drows(i - 1)) Next End Sub Private Sub dvArea1_DataError(sender As System.Object, e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dvArea1.DataError End Sub Private Sub dvArea2_DataError(sender As System.Object, e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dvArea2.DataError End Sub Private Sub dvArea3_DataError(sender As System.Object, e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dvArea3.DataError End Sub Private Sub Button10_Click(sender As Object, e As EventArgs) Dim sd As New SaveFileDialog() If sd.ShowDialog() = DialogResult.OK Then DSET1.weather_group.WriteXml(sd.FileName) End If End Sub Private Sub Button9_Click(sender As Object, e As EventArgs) Dim sd As New OpenFileDialog() If sd.ShowDialog() = DialogResult.OK Then DSET1.weather_group.Clear() DSET1.weather_group.ReadXml(sd.FileName) DSET1.weather_group.AcceptChanges() End If End Sub Private Sub bsWGDep1_CurrentChanged(sender As Object, e As EventArgs) Handles bsWGDep1.CurrentChanged '//select 1 depth Dim drv As DataRowView = Me.bsWGDep1.Current If drv Is Nothing OrElse drv("code").ToString().Length < 6 Then bsWGDep2.Filter = "code='test'" Else Dim codeHeader As String = drv("code").ToString().Substring(0, 2) bsWGDep2.Filter = String.Format("code like '{0}%' and code not like '%0000' and code like '%00'", codeHeader) End If End Sub Private Sub bsWGDep2_CurrentChanged(sender As Object, e As EventArgs) Handles bsWGDep2.CurrentChanged '//select 2 depth Dim drv As DataRowView = Me.bsWGDep2.Current If drv Is Nothing OrElse drv("code").ToString().Length < 6 Then bsWGDep3.Filter = "code='test'" Else Dim codeHeader As String = drv("code").ToString().Substring(0, 4) bsWGDep3.Filter = String.Format("code like '{0}%' and code not like '%00'", codeHeader) End If End Sub Private Sub bsWGDep3_CurrentChanged(sender As Object, e As EventArgs) Handles bsWGDep3.CurrentChanged End Sub Private Sub ToolStripButton8_Click(sender As Object, e As EventArgs) Handles ToolStripButton8.Click ' Dim sd As New FolderBrowserDialog() ' If sd.ShowDialog() = DialogResult.OK Then 'Eco2는 바로 내보내기하면 된다 'DSET1.weather_cha.Clear() 'DSET1.weather_ilsa.Clear() 'DSET1.weather_supdo.Clear() 'DSET1.weather_temp.Clear() 'DSET1.weather_cha.Merge(DSET1.weather_cha_od) 'DSET1.weather_ilsa.Merge(DSET1.weather_ilsa) 'DSET1.weather_supdo.Merge(DSET1.weather_supdo) 'DSET1.weather_temp.Merge(DSET1.weather_temp) Me.Validate() Me.bsw_river.EndEdit() Me.bsw_water.EndEdit() Me.bsw_wind.EndEdit() '모든파일을 저장한다. Dim SelectedPath As String = AppDomain.CurrentDomain.BaseDirectory + "Data" Dim file1 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_cha.TableName + ".xml") Dim file2 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_ilsa.TableName + ".xml") Dim file3 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_supdo.TableName + ".xml") Dim file4 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_temp.TableName + ".xml") Dim file5 As String = System.IO.Path.Combine(SelectedPath, DSET1.tbl_weather.TableName + ".xml") Dim file6 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_group.TableName + ".xml") Dim file7 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_wind.TableName + ".xml") Dim file8 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_river.TableName + ".xml") Dim file9 As String = System.IO.Path.Combine(SelectedPath, DSET1.weather_water.TableName + ".xml") DSET1.weather_cha.WriteXml(file1) DSET1.weather_ilsa.WriteXml(file2) DSET1.weather_supdo.WriteXml(file3) DSET1.weather_temp.WriteXml(file4) DSET1.tbl_weather.WriteXml(file5) DSET1.weather_group.WriteXml(file6) DSET1.weather_wind.WriteXml(file7) DSET1.weather_river.WriteXml(file8) DSET1.weather_water.WriteXml(file9) file1 = System.IO.Path.Combine(SelectedPath, DSET1.weather_cha.TableName + ".dat") file2 = System.IO.Path.Combine(SelectedPath, DSET1.weather_ilsa.TableName + ".dat") file3 = System.IO.Path.Combine(SelectedPath, DSET1.weather_supdo.TableName + ".dat") file4 = System.IO.Path.Combine(SelectedPath, DSET1.weather_temp.TableName + ".dat") file5 = System.IO.Path.Combine(SelectedPath, DSET1.tbl_weather.TableName + ".dat") file6 = System.IO.Path.Combine(SelectedPath, DSET1.weather_group.TableName + ".dat") file7 = System.IO.Path.Combine(SelectedPath, DSET1.weather_wind.TableName + ".dat") file8 = System.IO.Path.Combine(SelectedPath, DSET1.weather_river.TableName + ".dat") file9 = System.IO.Path.Combine(SelectedPath, DSET1.weather_water.TableName + ".dat") '//암호화 Serialize(file1, DSET1.weather_cha) Serialize(file2, DSET1.weather_ilsa) Serialize(file3, DSET1.weather_supdo) Serialize(file4, DSET1.weather_temp) Serialize(file5, DSET1.tbl_weather) Serialize(file6, DSET1.weather_group) Serialize(file7, DSET1.weather_wind) Serialize(file8, DSET1.weather_river) Serialize(file9, DSET1.weather_water) 'Using stm As System.IO.Stream = System.IO.File.Open(file6, System.IO.FileMode.Create, System.IO.FileAccess.Write) ' Dim bf As System.Runtime.Serialization.Formatters.Binary.BinaryFormatter = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter '역직렬화 후 객체 클래스로 형변환... Dim a As clsTEST = CType(bf.Deserialize(stm), clsTEST) stm.Close() ' bf.Serialize(stm, DSET1.weather_group) 'End Using 'Serialize(file6, DSET1.weather_group) ' End If End Sub Sub Serialize(filename As String, data As Object) Dim ms As New System.IO.MemoryStream() ' Using stm As System.IO.Stream = System.IO.File.Open(filename, System.IO.FileMode.Create, System.IO.FileAccess.Write) Dim bf As System.Runtime.Serialization.Formatters.Binary.BinaryFormatter = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter '역직렬화 후 객체 클래스로 형변환... Dim a As clsTEST = CType(bf.Deserialize(stm), clsTEST) stm.Close() bf.Serialize(ms, data) ' End Using Dim len As UInt32 = ms.Length Dim bodybuf(len - 1) As Byte Array.Copy(ms.GetBuffer(), bodybuf, len) Dim compbuf() As Byte = Nothing Utility.MiniLZO.Compress(bodybuf, compbuf) 'Dim decombuf(bodybuf.Length - 1) As Byte 'Utility.MiniLZO.Decompress(compbuf, decombuf) '67682 -> 304964 Dim complen As UInt32 = compbuf.Length Dim fs As New System.IO.FileStream(filename, IO.FileMode.Create) Dim lenbuf() As Byte = BitConverter.GetBytes(bodybuf.Length) '//read body data fs.Write(lenbuf, 0, lenbuf.Length) 'write file length 'Dim body() As Byte = ms.GetBuffer() fs.Write(compbuf, 0, complen) 'write body fs.Flush() fs.Dispose() ms.Dispose() End Sub Private Sub ToolStripButton13_Click(sender As Object, e As EventArgs) Handles ToolStripButton13.Click Dim sd As New FolderBrowserDialog() If sd.ShowDialog() = DialogResult.OK Then DSET1.weather_cha.Clear() DSET1.weather_ilsa.Clear() DSET1.weather_supdo.Clear() DSET1.weather_temp.Clear() DSET1.weather_group.Clear() DSET1.weather_wind.Clear() DSET1.weather_river.Clear() DSET1.weather_water.Clear() DSET1.tbl_weather.Clear() DSET1.weather_cha.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_cha.TableName + ".xml")) DSET1.weather_ilsa.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_ilsa.TableName + ".xml")) DSET1.weather_supdo.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_supdo.TableName + ".xml")) DSET1.weather_temp.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_temp.TableName + ".xml")) DSET1.tbl_weather.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.tbl_weather.TableName + ".xml")) DSET1.weather_group.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_group.TableName + ".xml")) DSET1.weather_wind.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_wind.TableName + ".xml")) DSET1.weather_river.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_river.TableName + ".xml")) DSET1.weather_water.ReadXml(System.IO.Path.Combine(sd.SelectedPath, DSET1.weather_water.TableName + ".xml")) '//od는 od 데이터에 다시 옴겨야한다 DSET1.weather_cha.AcceptChanges() DSET1.weather_ilsa.AcceptChanges() DSET1.weather_supdo.AcceptChanges() DSET1.weather_temp.AcceptChanges() DSET1.tbl_weather.AcceptChanges() DSET1.weather_group.AcceptChanges() DSET1.weather_wind.AcceptChanges() DSET1.weather_river.AcceptChanges() DSET1.weather_water.AcceptChanges() End If End Sub Private Sub MyTb33_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles tbw01.KeyDown If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 12 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) 'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가 'MsgBox(CB.GetUpperBound(0)) Dim Cnt As Short = 0 For i As Integer = 1 To CB.GetUpperBound(0) Select Case i Case 1 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw01.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw02.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw03.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw04.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw05.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw06.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw07.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw08.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw09.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 12 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbw12.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next '//If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동 Next Me.bsw_water.EndEdit() End If End Sub Private Sub MyTb21_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles tbr01.KeyDown ''river If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 12 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) 'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가 'MsgBox(CB.GetUpperBound(0)) Dim Cnt As Short = 0 For i As Integer = 1 To CB.GetUpperBound(0) Select Case i Case 1 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr01.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr02.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr03.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr04.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr05.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr06.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr07.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr08.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr09.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 12 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbr12.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next '//If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동 Next Me.bsw_river.EndEdit() End If End Sub Private Sub MyTb9_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles tbwi01.KeyDown ''wind\ If e.KeyCode = Keys.V And e.Control Then e.Handled = True e.SuppressKeyPress = False '//클립보드붙여넣기 Dim CB() As String = My.Computer.Clipboard.GetText.Split(CChar(vbCrLf)) If CB.GetUpperBound(0) < 12 Then MsgBox("붙여넣기가 호환되는 데이터가 아닙니다.", MsgBoxStyle.Information, "확인") Return End If For ii As Integer = 0 To CType(CB(0).Split(CChar(vbTab)), String()).GetUpperBound(0) 'If Me.bs.Count = 0 OrElse ii > 0 Then Me.bt_Add.PerformClick() '//한줄추가 'MsgBox(CB.GetUpperBound(0)) Dim Cnt As Short = 0 For i As Integer = 1 To CB.GetUpperBound(0) Select Case i Case 1 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi01.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 2 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi02.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 3 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi03.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 4 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi04.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 5 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi05.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 6 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi06.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 7 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi07.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 8 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi08.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 9 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi09.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 10 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi10.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 11 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi11.Text = CB(i).Split(CChar(vbTab))(ii).Trim Case 12 '///조명은 신규기록하지않으므로.. 쓰지않게한다. Me.tbwi12.Text = CB(i).Split(CChar(vbTab))(ii).Trim End Select Next '//If bsw_cha.Position < bsw_cha.Count Then bsw_cha.Position += 1 '//위치이동 Next Me.bsw_wind.EndEdit() End If End Sub End Class