Search Results

Search found 251 results on 11 pages for 'msgbox'.

Page 2/11 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11  | Next Page >

  • MessageBox if Recordset Update is Successful

    - by Paolo Bernasconi
    In Access 2007, I have a form to add a new contact to a table: RecSet.AddNew RecSet![Code_Personal] = Me.txtCodePersonal.Value RecSet![FName] = Me.TxtFName.Value RecSet![LName] = Me.txtLName.Value RecSet![Tel Natel] = Me.txtNatTel.Value RecSet![Tel Home] = Me.txtHomeTel.Value RecSet![Email] = Me.txtEmail.Value RecSet.Update This has worked so far, and the contact has successfully been aded. But I'm having two problems: I want to display a messagebox to tell the user the contact was successfully added If the contact was not successfully added because A contact with this name already exists A different issue Then display a message box "Contact already exists" or "error occured" respectively. My idea of doing this is: If recSet.Update = true Then MsgBox "Paolo Bernasconi was successfully added" Else if RecSet![FName] & RecSet![LName] 'already exist in table MsgBox "Contact already exists" Else MsgBox "An unknown error occured" I know this code is wrong, and obviously doesn't work, but it's just to give you an idea of what I'm trying to achieve. Thanks for all your help in advance.

    Read the article

  • Macro VBA to get selected text in Outlook 2003

    - by balalakshmi
    I am trying to use this code snippet to get the selected text in outlook 2003 Sub SelectedTextDispaly() On Error Resume Next Err.Clear Dim oText As TextRange ''# Get an object reference to the selected text range. Set oText = ActiveWindow.Selection.TextRange ''# Check to see whether error occurred when getting text object ''# reference. If Err.Number <> 0 Then MsgBox "Invalid Selection. Please highlight some text " _ & "or select a text frame and run the macro again.", _ vbExclamation End End If ''# Display the selected text in a message box. If oText.Text = "" Then MsgBox "No Text Selected.", vbInformation Else MsgBox oText.Text, vbInformation End If End Sub When running this macro I get the error --------------------------- Microsoft Visual Basic --------------------------- Compile error: User-defined type not defined Do I need to add any references to fix this up?

    Read the article

  • AutoIt simulate new script line

    - by Renato Böhler
    I need some way to loop in a single line. Is there a way to simulate new lines in AutoIt? Because if I try While 1 MsgBox (0,1,2) Wend It will not work. So I was wondering if there is a way to simulate a new line, something like While 1 - MsgBox (0,1,2) - Wend Or some function to do this. I also already tried to make this: Func repeat($func, $limit) $i = 0 While $i <= $limit Execute($func) $i = $i + 1 WEnd EndFunc But it only executes Execute($func) once, even if I change While $i <= $limit for While 1. I have tried Execute("While $i <= 5" & @LF & "MsgBox(0, 1, 24)" & @LF & "$i = $i + 1" & @LF & "WEnd") too, it doesn't work even if I change @LF for @CRLF, @CR, Chr(13), \n, \r... Any ideas?

    Read the article

  • Cannot update any cells in datagrid in vb6

    - by Hybrid SyntaX
    Hello I'm trying to update a row in datagrid but the problem is that i can't even change its cell values I had set my datagrid AllowUpdate property to true , but i can't still change any cell values Option Explicit Dim conn As New ADODB.Connection Dim cmd As New ADODB.Command Dim recordset As New ADODB.recordset Public Action As String Public Person_Id As Integer Public Selected_Person_Id As Integer Public Phone_Type As String Public Sub InitializeConnection() Dim str As String str = _ "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" + App.Path + "\phonebook.mdb;" & _ "Persist Security Info=False" conn.CursorLocation = adUseClient If conn.state = 0 Then conn.ConnectionString = str conn.Open (conn.ConnectionString) End If End Sub Public Sub AbandonConnection() If conn.state <> 0 Then conn.Close End If End Sub Public Sub Persons_Read() Dim qry_all As String ' qry_all = "select * from person,web,phone Where web.personid = person.id And phone.personid = person.id" qry_all = "SELECT * FROM person order by id" Call InitializeConnection cmd.CommandText = qry_all cmd.CommandType = adCmdText Set cmd.ActiveConnection = conn If conn.state = 1 Then Set recordset = cmd.Execute() End If BindDatagrid End Sub Private Function Person_Delete(id As Integer) Dim qry_all As String qry_all = "Delete * from person where person.id= " & id & " " Call InitializeConnection cmd.CommandText = qry_all cmd.CommandType = adCmdText Set cmd.ActiveConnection = conn If conn.state = 1 Then Set recordset = cmd.Execute() End If dg_Persons.Refresh End Function Private Function Person_Update() End Function Public Sub BindDatagrid() Set Me.dg_Persons.DataSource = recordset Me.dg_Persons.Refresh dg_Persons.Columns(0).Visible = False dg_Persons.Columns(4).Visible = False dg_Persons.Columns(1).Caption = "Name" dg_Persons.Columns(2).Caption = "Family" dg_Persons.Columns(3).Caption = "Nickname" dg_Persons.Columns(5).Caption = "Title" dg_Persons.Columns(6).Caption = "Job" End Sub Public Function DatagridReferesh() Call Me.Persons_Read End Function Private Sub cmd_Add_Click() frm_Person_Add.Caption = "Add a new person" frm_Person_Add.Show End Sub Private Sub cmd_Business_Click() ' frm_Phone.Caption = "Business Phones" frm_Phone.Phone_Type = "Business" frm_Phone.Person_Id = Selected_Person_Id frm_Phone.Tag = Selected_Person_Id frm_Phone.Show End Sub Private Sub cmd_Delete_Click() Dim msg_input As Integer msg_input = MsgBox("Are you sure you want to delete this person ?", vbYesNo) If msg_input = vbYes Then Person_Delete Selected_Person_Id MsgBox ("The person is deleted") frm_Phone.DatagridReferesh End If End Sub Private Sub cmd_Home_Click() 'frm_Phone.Caption = "Home Phones" frm_Phone.Phone_Type = "Home" frm_Phone.Person_Id = Selected_Person_Id frm_Phone.Tag = Selected_Person_Id frm_Phone.Show End Sub Private Sub cmd_Update_Click() If Not Selected_Person_Id = 0 Then frm_Person_Edit.Person_Id = Selected_Person_Id frm_Person_Edit.Show Else MsgBox "No person is selected" End If End Sub Public Function AddParam(name As String, param As Variant, paramType As DataTypeEnum) As ADODB.Parameter If param = "" Or param = Null Then param = " " End If Dim objParam As New ADODB.Parameter Set objParam = cmd.CreateParameter(name, paramType, adParamInput, Len(param), param) objParam.Value = Trim(param) Set AddParam = objParam End Function Private Sub Command1_Click() DatagridReferesh End Sub Private Sub Command2_Click() frm_Internet.Person_Id = Selected_Person_Id frm_Internet.Show End Sub Private Sub dg_Persons_BeforeColEdit(ByVal ColIndex As Integer, ByVal KeyAscii As Integer, Cancel As Integer) ' MsgBox ColIndex ' dg_Persons.Columns(ColIndex).Text = "S" ' dg_Persons.Columns(ColIndex).Locked = False ' dg_Persons.Columns(ColIndex).Text = "" 'dg_Persons.Columns(ColIndex).Value = "" 'Person_Edit dg_Persons.Columns(0).Value, dg_Persons.Columns(1).Value, dg_Persons.Columns(2).Value,dg_Persons.Columns(3).Value,dg_Persons.Columns(4).Value, dg_Persons.Columns(5).Value End Sub Private Sub dg_Persons_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer) MsgBox ColIndex End Sub Private Sub dg_Persons_Click() If dg_Persons.Row <> -1 Then dg_Persons.SelBookmarks.Add Me.dg_Persons.RowBookmark(dg_Persons.Row) Selected_Person_Id = Val(dg_Persons.Columns(0).Value) End If End Sub Private Sub Form_Load() ' dg_Persons.AllowUpdate = True ' dg_Persons.EditActive = True Call Persons_Read dg_Persons.AllowAddNew = True dg_Persons.Columns(2).Locked = False End Sub Private Function Person_Edit(id As Integer, name As String, family As String, nickname As String, title As String, job As String) InitializeConnection cmd.CommandText = "Update person set name=@name , family=@family , nickname=@nickname , title =@title , job=@job where id= " & id & "" cmd.Parameters.Append AddParam("name", name, adVarChar) cmd.Parameters.Append AddParam("family", family, adVarChar) cmd.Parameters.Append AddParam("nickname", nickname, adVarChar) cmd.Parameters.Append AddParam("title", title, adVarChar) cmd.Parameters.Append AddParam("job", job, adVarChar) cmd.ActiveConnection = conn cmd.CommandType = adCmdText cmd.Execute End Function Private Function Person_Search(q As String) Dim qry_all As String qry_all = "SELECT * FROM person where person.name like '%" & q & "%' or person.family like '%" & q & "%' or person.nickname like '%" & q & "%'" Call InitializeConnection cmd.CommandText = qry_all cmd.CommandType = adCmdText Set cmd.ActiveConnection = conn If conn.state = 1 Then Set recordset = cmd.Execute() End If BindDatagrid End Function Private Sub mnu_About_Click() frm_About.Show End Sub Private Sub submnu_exit_Click() End End Sub Private Sub txt_Search_Change() Person_Search txt_Search.Text End Sub Thanks in advance

    Read the article

  • Changing array values in a VBA dictionary

    - by Pawan Jain
    Hi I have a piece of code that does not seem to do what it is expected to do. VBA Arrays are mutable by all means, but it seems that when they are stored into a Dictionary as values of some keys, they are not mutable anymore. Any ideas? Sub foo() Dim mydict As New Dictionary mydict.Add "A", Array(1, 2, 3) MsgBox mydict("A")(1) ' The above shows 2, which is fine mydict("A")(1) = 34 MsgBox mydict("A")(1) ' The above also shows 2, which is not fine End Sub

    Read the article

  • File Folder copy

    - by Dario Dias
    Below is the VBScript code. If the file/s or folder exist I get scripting error, "File already exists". How to fix that? How to create folder only if it does not exist and copy files only that are new or do not exist in source path? How to insert the username (Point 1) after "Welcome" and at (Poin 3) instead of user cancelled? Can the buttons be changed to Copy,Update,Cancel instead of Yes,No,Cancel? (Point 2) The code: Set objFSO = CreateObject("Scripting.FileSystemObject") Set wshShell = WScript.CreateObject( "WScript.Shell" ) strUserName = wshShell.ExpandEnvironmentStrings( "%USERNAME%" ) Message = " Welcome to the AVG Update Module" & vbCR '1* Message = Message & " *****************************" & vbCR & vbCR Message = Message & " Click Yes to Copy Definition Files" & vbCR & vbCR Message = Message & " OR " & vbCR & vbCR Message = Message & " Click No to Update Definition Files." & vbCR & vbCR Message = Message & " Click Cancel (ESC) to Exit." & vbCR & vbCR X = MsgBox(Message, vbYesNoCancel, "AVG Update Module") '2* 'Yes Selected Script If X = 6 then objFSO.FolderExists("E:\Updates") if TRUE then objFSO.CreateFolder ("E:\Updates") objFSO.CopyFile "c:\Docume~1\alluse~1\applic~1\avg8\update\download\*.*", "E:\Updates\" , OverwriteFiles MsgBox "Files Copied Succesfully.", vbInformation, "Copy Success" End If 'No Selected Script If X = 7 then objFSO.FolderExists("Updates") if TRUE then objFSO.CreateFolder("Updates") objFSO.CopyFile "E:\Updates\*.*", "Updates", OverwriteFiles Message = "Files Updated Successfully." & vbCR & vbCR Message = Message & "Click OK to Launch AVG GUI." & vbCR & vbCR Message = Message & "Click Cancel (ESC) to Exit." & vbCR & vbCR Y = MsgBox(Message, vbOKCancel, "Update Success") If Y = 1 then Set WshShell = CreateObject("WScript.Shell") WshShell.Run chr(34) & "C:\Progra~1\avg\avg8\avgui.exe" & Chr(34), 0 Set WshShell = Nothing End if If Y = 3 then WScript.Quit End IF 'Cancel Selection Script If X = 2 then MsgBox "No Files have been Copied/Updated.", vbExclamation, "User Cancelled" '3* End if

    Read the article

  • Problem with a "Select Case"

    - by Nimrod
    i wrote the following section below. when debugging, i see that i enter the first Case okay. my problem is with the second Case - it does not enter it and goes to the error messege. what do i do wrong? Select Case Data_Rate Case "1", "2", "5.5", "11", "6", "9", "12", "18", "24", "36", "48", "54" a = Data_Rate Select Case Date_Rate Case "1" b = 2 Case "2", "5.5", "11" b = 1 Case Else: MsgBox ("ERROR - Data_Rate") End Select Case "0", "1", "2", "3", "4", "5", "6", "7" a = 3 Case Else: MsgBox ("ERROR - Data_Rate") End Select

    Read the article

  • I get a error message from my vb6 program.

    - by user292084
    Private Sub Command1_Click() Dim dom As New DOMDocument Dim http As New XMLHTTP Dim strRet As String If Not dom.Load("c:\\CH.xml") Then MsgBox "?????" http.Open "Post", "http://172.31.132.173/u8eai/import.asp", True '?????ASP http.send dom.xml '?xml???????? strRet = http.responseText 'strRet:???xml??????? MsgBox strRet End Sub The error message, in Chinese: ???? ???????????????. translated by google(To English): Real-time error The data needed to complete the operation can not be used also

    Read the article

  • Weird bug on powerpoint vba

    - by asksuperuser
    I have a "mynote" textbox on a slide. If I execute: Sub test() If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then MsgBox "ok" End If end sub It works. But If I attach a shape with this macro: Sub test(oShape As Shape) If ActiveWindow.Selection.SlideRange.Shapes("mynote").Visible Then MsgBox "ok" End If end sub It doesn't work (no error message, no "ok" message)

    Read the article

  • compilation error in vc++ vs2005

    - by vijay.j
    I am getting an error while compiling in vc++ vs2005. error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function "void __cdecl MsgBox(char const *,char const *,...)" (?MsgBox@@YAXPBD0ZZ)

    Read the article

  • How to create collection object in vbscript?

    - by Onnesh
    what should be the parameter for create object the following code dim a set a=CreateObject("Collection") //getting a runtime error saying ActiveX //component can't create object: 'Collection a.add(CreateObject("Collection")) a.Items(0).Add(1) MsgBox(a.Items(0).count) MsgBox(a.Items(0).Item(0))

    Read the article

  • need help me in excel-vba

    - by aos
    Private Sub cmdClear_Click() Dim Confirm As Integer Confirm = MsgBox("Are you sure you want clear this Sheet?", vbYesNo, "WARNING: Date Changed") If Confirm = 6 Then Sheets("OPV").Activate 'Sheets("OPV").Activate Sheets("OPV").Range("B4:BZ1000").ClearContents Sheets("OPV").Range("B4:BZ1000").Interior.Pattern = xlNone Sheets("OPV").Activate Sheets("OPV").Range("B4").Activate MsgBox " Done .. ", vbInformation, "Clear ......" End If End Sub

    Read the article

  • Using the RSSBus Salesforce Excel Add-In From Excel Macros (VBA)

    - by dataintegration
    The RSSBus Salesforce Excel Add-In makes it easy to retrieve and update data from Salesforce from within Microsoft Excel. In addition to the built-in wizards that make data manipulation possible without code, the full functionality of the RSSBus Excel Add-Ins is available programmatically with Excel Macros (VBA) and Excel Functions. This article shows how to write an Excel macro that can be used to perform bulk inserts into Salesforce. Although this article uses the Salesforce Excel Add-In as an example, the same process can be applied to any of the Excel Add-Ins available on our website. Step 1: Download and install the RSSBus Excel Add-In available on our website. Step 2: Open Excel and create place holder cells for the connection details that are needed from the macro. In this article, a spreadsheet will be created for batch inserts, and these cells will store the connection details, and will be used to report the job Id, the batch Id, and the batch status. Step 3: Switch to the Developer tab in Excel. Add a new button on the spreadsheet, and create a new macro associated with it. This macro will contain the code needed to insert a batch of rows into Salesforce. Step 4: Add a reference to the Excel Add-In by selecting Tools --> References --> RSSBus Excel Add-In. The macro functions of the Excel Add-In will be available once the reference has been added. The following code shows how to call a Stored Procedure. In this example, a job is created to insert Leads by calling the CreateJob stored procedure. CreateJob returns a jobId that can be used to upload a large number of Leads in one transaction. Note the use of cells B1, B2, B3, and B4 that were created in Step 2 to read the connection settings from the Excel SpreadSheet and to write out the status of the procedure. methodName = "CreateJob" module.SetProviderName ("Salesforce") nameArray = Array("ObjectName", "Action", "ConcurrencyMode") valueArray = Array("Lead", "insert", "Serial") user = Range("B1").value pass = Range("B2").value atoken = Range("B3").value If (Not user = "" And Not pass = "" And Not atoken = "") Then module.SetConnectionString ("User=" + user + ";Password=" + pass + ";Access Token=" + atoken + ";") If module.CallSP(methodName, nameArray, valueArray) Then Dim ColumnCount As Integer ColumnCount = module.GetColumnCount Dim idIndex As Integer For Count = 0 To ColumnCount - 1 Dim colName As String colName = module.GetColumnName(Count) If module.GetColumnName(Count) = "id" Then idIndex = Count End If Next While (Not module.EOF) Range("B4").value = module.GetValue(idIndex) module.MoveNext Wend Else MsgBox "The CreateJob query failed." End If Exit Sub Else MsgBox "Please specify the connection details." Exit Sub End If Error: MsgBox "ERROR: " & Err.Description Step 5: Add the code to your macro. If you use the code above, you can check the results at Salesforce.com. They can be seen at Administration Setup -> Monitoring -> Bulk Data Load Jobs. Download the attached sample file for a more complete demo. Distributing an Excel File With Macros An Excel file with macros is saved using the .xlms extension. The code for the macro remains in the Excel file, and you can distribute your Excel file to any machine where the RSSBus Salesforce Excel Add-In is already installed. Macro Sample File Please download the fully functional sample excel file that includes the code referenced here. You will also need the RSSBus Excel Add-In to make the connection. You can download a free trial here. Note: You may get an error message stating: "Can't find project or library." in Excel 2007, since this example is made using Excel 2010. To resolve this, navigate to Tools -> References and uncheck the "MISSING: RSSBus Excel Add-In", then scroll down and check the "RSSBus Excel Add-In" listed below it.

    Read the article

  • Javascript: Error 'Object Required.'

    - by javascripthelp
    The following is the error popup message I get when I click "Finalize" button on my website: "Line: 298 Char: 5 Error: Object required: 'lobi_c_selected(...)' Code: 0 URL: http://10.128.23.50/i-prostage/AP/w_ap_check_reconciliation.asp?" Normally, when I click "Finalize" button, it'll generate and show a report in a popup window. However, I'd get this error message instead. Can any of you help me locate the error in the following source code for the page that I'm running in IE 6? sub cb_finalize dim ll_loop, ll_found, lobj_c_selected of_SetHourGlass(True) rpt_link.innerHTML = "" rpt_link.href = "" 'Process only if at least one record was selected if rds1.Recordset.Recordcount 0 then lb_found = false if rds1.Recordset.Recordcount = 1 then if c_selected.checked then lb_found = true else Set lobj_c_selected = document.all.item("c_selected") for ll_loop = 1 to rds1.Recordset.Recordcount if lobj_c_selected(ll_loop - 1).checked then lb_found = true exit for end if next end if if not lb_found then msgbox "Please select a record to be posted.", vbInformation, "ProStage Accounting" of_SetHourGlass(False) else window.setTimeout "ue_process()", 100, vbscript 'Post Event end if else msgbox "There's no record to be posted." + vbcrlf + "Please select a record to be posted.", vbInformation, "ProStage Accounting" of_SetHourGlass(False) end if end sub Sub ue_process dim ll_loop, ll_count, ls_ret, ls_trxid, ls_r1 'Get only selected records redim ls_trxid(rds1.Recordset.Recordcount) for ll_loop = 1 to rds1.Recordset.Recordcount rds1.Recordset.AbsolutePosition = ll_loop if not isnull(rds1.Recordset("clrdt")) then 'Add to TRXID array if selected ll_count = ll_count + 1 ls_trxid(ll_count) = rds1.Recordset("trxid") end if next 'Process reconciliation rds1.Recordset.MarshalOptions = 1 ls_ret = iBO_Update.of_update_1(is_dbsrc, rds1.Recordset, "GLTRX", is_sql) if ls_ret < "1" then msgbox "Update Failed ! " + ls_ret, vbExclamation + vbOKonly, document.title of_SetHourGlass(False) else 'Display Posting Journal & clear screen ue_posting_journal ls_trxid, ll_count Set rds1.SourceRecordset = iBO_Company.of_validate(is_dbsrc, "SELECT 1 FROM DUAL WHERE 1 = 2") ib_query = false 'Not to process RetrieveEnd end if End Sub Sub ue_posting_journal(as_trxid, al_count) dim ll_argseq, ls_argtyp, ls_argmnt, ll_sargseq of_setreport() ' Start service 'Prepare arguments for report in RPTMSTR table for ll_loop = 1 to al_count + 1 select case ll_loop case 1 'Range displayed as report title ll_argseq = 800 ls_argtyp = null ls_argmnt = "st_title.text = 'Bank: " + bnkid_name.value + ", As of Date: " + _ of_date_stringtodate(id_trxdt) + "'" ll_sargseq = 0 case else 'TRXID array ll_argseq = 1 ll_sargseq = ll_loop - 1 ls_argtyp = "S" ls_argmnt = as_trxid(ll_loop - 1) end select of_report_register_array "d_rpt_ap_check_reconciliation_register", ll_argseq, ls_argtyp, ls_argmnt, ll_sargseq next of_report_process "d_rpt_ap_check_reconciliation_register", true, true 'Display report of_sethourglass(False) End Sub

    Read the article

  • VB .NET error handling, pass error to caller

    - by user1375452
    this is my very first project on vb.net and i am now struggling to migrate a vba working add in to a vb.net COM Add-in. I think i'm sort of getting the hang, but error handling has me stymied. This is a test i've been using to understand the try-catch and how to pass exception to caller Public Sub test() Dim ActWkSh As Excel.Worksheet Dim ActRng As Excel.Range Dim ActCll As Excel.Range Dim sVar01 As String Dim iVar01 As Integer Dim sVar02 As String Dim iVar02 As Integer Dim objVar01 As Object ActWkSh = Me.Application.ActiveSheet ActRng = Me.Application.Selection ActCll = Me.Application.ActiveCell iVar01 = iVar02 = 1 sVar01 = CStr(ActCll.Value) sVar02 = CStr(ActCll.Offset(1, 0).Value) Try objVar01 = GetValuesV(sVar01, sVar02) 'DO SOMETHING HERE Catch ex As Exception MsgBox("ERRORE: " + ex.Message) 'LOG ERROR SOMEWHERE Finally MsgBox("DONE!") End Try End Sub Private Function GetValuesV(ByVal QryStr As Object, ByVal qryConn As String) As Object Dim cnn As Object Dim rs As Object Try cnn = CreateObject("ADODB.Connection") cnn.Open(qryConn) rs = CreateObject("ADODB.recordset") rs = cnn.Execute(QryStr) If rs.EOF = False Then GetValuesV = rs.GetRows Else Throw New System.Exception("Query Return Empty Set") End If Catch ex As Exception Throw ex Finally rs.Close() cnn.Close() End Try End Function i'd like to have the error message up to test, but MsgBox("ERRORE: " + ex.Message) pops out something unexpected (Object variable or With block variable not set) What am i doing wrong here?? Thanks D

    Read the article

  • JQuery ajax success help

    - by Jason
    Hi all, I am implementing a "Quick delete" function into a page I am creating. The way it works is like this: 1: You click the "delete" button in the table row for the record that you want to delete. 2: The page sends a request to the ajax page and return a successfully message of "yes" or a failure message of "no". My issue is that if I get a successful message of "yes" I want to hide the row for that record. I am having issue "finding" the row using JQuery. Here is my jquery code: $(document).ready(function(){ $(".pane .btn-delete").click(function(){ var element = $(this); var del_id = element.attr("id"); var dataString = 'action=del&cid=' + del_id; if(confirm("Are you sure you want to delete this content block?")) { $("#msgbox").addClass('ajaxmsg').text('Checking permissions....').fadeIn(1000); $.ajax({ type: "get", url: "ajax/admArticles_ajax.php", data: dataString, success: function(data){ switch(data) { case "yes": $("#msgbox").addClass('ajaxmsg').text('Deleting content block....').fadeIn(1000); $(this).parents(".pane").animate({ backgroundColor: "#fbc7c7" }, "fast") .animate({ opacity: "hide" }, "slow") break case "no": $("#msgbox").removeClass().addClass('error').text('You do not have the correct permissions to delete this content....').fadeIn(1000); break default: }; } }); } return false; }); }); This is the lines of code I am using to hide the row however it is not working because I don't think $(this).parents(".pane") finds the element. $(this).parents(".pane").animate({ backgroundColor: "#fbc7c7" }, "fast") .animate({ opacity: "hide" }, "slow") Any help would be greatly appreciated. Thanks...

    Read the article

  • VBS script works on XP 32-bit but not on 7 64-bit

    - by neurolysis
    This script (a modification of one of Rob van der Woude's) works fine on XP 32-bit, but fails on 7 64-bit at Set objDialog = CreateObject( "UserAccounts.CommonDialog" ), with something similar to the error (translated from Dutch) ActiveX cannot create the object "UserAccounts.CommonDialog". Is there some different way that I have to do this for it to be compatible with Windows 7? MsgBox("Your input avi MUST be exported at 60fps, or this script will not work."),0,"IMPORTANT!" MsgBox("Please select the location of your AVI."),0,"AVI location" WScript.Echo GetFileName( "", "AVI files (*.avi)|*.avi" ) Function GetFileName( myDir, myFilter ) Dim objDialog Set objDialog = CreateObject( "UserAccounts.CommonDialog" ) If myDir = "" Then objDialog.InitialDir = CreateObject( "WScript.Shell" ).SpecialFolders( "MyDocuments" ) Else objDialog.InitialDir = myDir End If If myFilter = "" Then objDialog.Filter = "All files|*.*" Else objDialog.Filter = myFilter End If If objDialog.ShowOpen Then GetFileName = objDialog.FileName Else GetFileName = "" End If End Function

    Read the article

  • Excel 2010: dynamic update of drop down list based upon datasource validation worksheet changes

    - by hornetbzz
    I have one worksheet for setting up the data sources of multiple data validation lists. in other words, I'm using this worksheet to provide drop down lists to multiple other worksheets. I need to dynamically update all worksheets upon any of a single or several changes on the data source worksheet. I may understand this should come with event macro over the entire workbook. My question is how to achieve this keeping the "OFFSET" formula across the whole workbook ? Thx To support my question, I put the piece of code that I'm trying to get it working : Provided the following informations : I'm using such a formula for a pseudo dynamic update of the drop down lists, for example : =OFFSET(MyDataSourceSheet!$O$2;0;0;COUNTA(MyDataSourceSheet!O:O)-1) I looked into the pearson book event chapter but I'm too noob for this. I understand this macro and implemented it successfully as a test with the drop down list on the same worksheet as the data source. My point is that I don't know how to deploy this over a complete workbook. Macro related to the datasource worksheet : Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) ' Macro to update all worksheets with drop down list referenced upon ' this data source worksheet, base on ref names Dim cell As Range Dim isect As Range Dim vOldValue As Variant, vNewValue As Variant Dim dvLists(1 To 6) As String 'data validation area Dim OneValidationListName As Variant dvLists(1) = "mylist1" dvLists(2) = "mylist2" dvLists(3) = "mylist3" dvLists(4) = "mylist4" dvLists(5) = "mylist5" dvLists(6) = "mylist6" On Error GoTo errorHandler For Each OneValidationListName In dvLists 'Set isect = Application.Intersect(Target, ThisWorkbook.Names("STEP").RefersToRange) Set isect = Application.Intersect(Target, ThisWorkbook.Names(OneValidationListName).RefersToRange) ' If a change occured in the source data sheet If Not isect Is Nothing Then ' Prevent infinite loops Application.EnableEvents = False ' Get previous value of this cell With Target vNewValue = .Value Application.Undo vOldValue = .Value .Value = vNewValue End With ' LOCAL dropdown lists : For every cell with validation For Each cell In Me.UsedRange.SpecialCells(xlCellTypeAllValidation) With cell ' If it has list validation AND the validation formula matches AND the value is the old value If .Validation.Type = 3 And .Validation.Formula1 = "=" & OneValidationListName And .Value = vOldValue Then ' Debug ' MsgBox "Address: " & Target.Address ' Change the cell value cell.Value = vNewValue End If End With Next cell ' Call to other worksheets update macros Call Sheets(5).UpdateDropDownList(vOldValue, vNewValue) ' GoTo NowGetOut Application.EnableEvents = True End If Next OneValidationListName NowGetOut: Application.EnableEvents = True Exit Sub errorHandler: MsgBox "Err " & Err.Number & " : " & Err.Description Resume NowGetOut End Sub Macro UpdateDropDownList related to the destination worksheet : Sub UpdateDropDownList(Optional vOldValue As Variant, Optional vNewValue As Variant) ' Debug MsgBox "Received info for update : " & vNewValue ' For every cell with validation For Each cell In Me.UsedRange.SpecialCells(xlCellTypeAllValidation) With cell ' If it has list validation AND the validation formula matches AND the value is the old value ' If .Validation.Type = 3 And .Value = vOldValue Then If .Validation.Type = 3 And .Value = vOldValue Then ' Change the cell value cell.Value = vNewValue End If End With Next cell End Sub

    Read the article

  • Getting an Access 2007 table (.accdb extension) in ArcMap programmatically

    - by Adrian
    I have recently found a script from ArcScripts on how to get an Access table in ArcGIS programmatically and it works well. But this is for Access 2003 (.mdb extension) and earlier. The code is posted below, and I want to know how to modify it for using Access 2007 (.accdb extension) and later databases. Attribute VB_Name = "Access_connect" Sub Open_Access_Connect() 'V. Guissard Jan. 2007 On Error GoTo EH Dim data_source As String Dim pTable As ITable Dim TableName As String Dim pFeatWorkspace As IFeatureWorkspace Dim pMap As IMap Dim mxDoc As IMxDocument Dim pPropset As IPropertySet Dim pStTab As IStandaloneTable Dim pStTabColl As IStandaloneTableCollection Dim pWorkspace As IWorkspace Dim pWorkspaceFact As IWorkspaceFactory Set pPropset = New PropertySet ' Get MDB file name data_source = GetFolder("mdb") ' Connect to the MDB database pPropset.SetProperty "CONNECTSTRING", "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data source=" & data_source & ";User ID=Admin;Password=" Set pWorkspaceFact = New OLEDBWorkspaceFactory Set pWorkspace = pWorkspaceFact.Open(pPropset, 0) Set pFeatWorkspace = pWorkspace ' Get table name TableName = SelectDataSet(pFeatWorkspace, "Table") ' Open the table Set pTable = pFeatWorkspace.OpenTable(TableName) 'Create Table collection and add the table to ArcMap Set mxDoc = ThisDocument Set pMap = mxDoc.FocusMap Set pStTab = New StandaloneTable Set pStTab.Table = pTable Set pStTabColl = pMap pStTabColl.AddStandaloneTable pStTab ' Update ArcMap Source TOC mxDoc.UpdateContents Exit Sub EH: MsgBox "Access connect: " & Err.Number & " " & Err.Description End Sub Public Function GetFolder(Optional aFilter As String) As String ' Open a GUI to let the user select a Folder path name (by default) or : ' Set aFilter = "shp" to get a shapefile name ' Set aFilter = "mdb" to get an MS Access file name ' Return the Folder Path or phath & file name As String ' V. Guissard Jan. 2007 Dim pGxDialog As IGxDialog Dim pFilterCol As IGxObjectFilterCollection Dim pCurrentFilter As IGxObjectFilter Dim pEnumGx As IEnumGxObject Select Case aFilter Case "shp" Set pCurrentFilter = New GxFilterShapefiles aTitle = "Select Shapefile" Case "mdb" Set pCurrentFilter = New GxFilterContainers aTitle = "Select MS Access database" Case Else Set pCurrentFilter = New GxFilterBasicTypes aTitle = "Select Folder" End Select Set pGxDialog = New GxDialog Set pFilterCol = pGxDialog With pFilterCol .AddFilter pCurrentFilter, True End With With pGxDialog .Title = aTitle .ButtonCaption = "Select" End With If Not pGxDialog.DoModalOpen(0, pEnumGx) Then Smp = MsgBox("No selection : Exit", vbCritical) End 'Exit Function 'Exit if user press Cancel End If GetFolder = pEnumGx.Next.FullName End Function Public Function SelectDataSet(pWorkspace As IWorkspace, Optional theDataType As String) As String ' Open a GUI to let the user select a DataSet into a Workspace ' (Table or Request into an MS Access Database or a Geodatabase File) ' Set pWorkspace to the DataSet IWorkspace ' Set theDataType = "Table" to select a Table name of the DataSet ' Return the selected Table or Request Table name As String ' V. Guissard Jan. 2007 Dim aDataset As Boolean Dim boolOK As Boolean Dim DataSetList As New Collection Dim datasetType As Integer Dim n As Integer Dim pDataSetName As IDatasetName Dim pListDlg As IListDialog Dim pEnumDatasetName As IEnumDatasetName ' Set the Dataset Type Select Case theDataType Case "Table" datasetType = 10 Case Else Answ = MsgBox("Need a Dataset Type : Exit", vbCritical, "SelectDataset") End End Select ' Get the Dataset Names included in the workspace Set pEnumDatasetName = pWorkspace.DatasetNames(datasetType) ' Create the Dataset Names List Dialog aDataset = False Set pListDlg = New ListDialog pEnumDatasetName.Reset Set pDataSetName = pEnumDatasetName.Next Do While Not pDataSetName Is Nothing pListDlg.AddString pDataSetName.name DataSetList.Add (pDataSetName.name) Set pDataSetName = pEnumDatasetName.Next aDataset = True Loop ' Open a GUI for the user to select a dataset If aDataset Then boolOK = pListDlg.DoModal("Select a " & theDataType, 0, Application.hwnd) n = pListDlg.choice If (n <> -1) Then SelectDataSet = DataSetList(n + 1) Else Sup = MsgBox("No DataSet selected : EXIT", vbCritical, "SelectDataset") End End If End If End Function Here is the link to the ArcScript: http://arcscripts.esri.com/Data/AS14882.bas PS I know this code is written in VBA and I don't know if a modified version is in VB.NET or whatever else language. Thanks, Adrian

    Read the article

  • Using Shader causes triangle to disappear

    - by invisal
    The following is my rendering code. Private Sub GameRender() GL.Clear(ClearBufferMask.ColorBufferBit + ClearBufferMask.DepthBufferBit) GL.ClearColor(Color.SkyBlue) GL.UseProgram(theProgram) GL.EnableClientState(ArrayCap.VertexArray) GL.EnableClientState(ArrayCap.ColorArray) GL.BindBuffer(BufferTarget.ArrayBuffer, vertexPositionID) GL.DrawArrays(BeginMode.Triangles, 0, 3) GL.DisableClientState(ArrayCap.ColorArray) GL.DisableClientState(ArrayCap.VertexArray) GlControl1.SwapBuffers() End Sub This is screenshot without GL.UseProgram(theProgram) This is screenshot with GL.UseProgram(theProgram) Here are my shader code that I picked from online tutorial. Vertex Shader #version 330 layout(location = 0) in vec4 position; void main() { gl_Position = position; } Fragment Shader #version 330 out vec4 outputColor; void main() { outputColor = vec4(1.0f, 1.0f, 1.0f, 1.0f); } These are my shader creation code. '' Initialize Shader Dim shaderList(1) As Integer shaderList(0) = CreateShader(ShaderType.VertexShader, strVertexShader) shaderList(1) = CreateShader(ShaderType.FragmentShader, strFragShader) theProgram = CreateProgram(shaderList) GL.DeleteShader(shaderList(0)) GL.DeleteShader(shaderList(1)) Here are my helper functions Private Function CreateShader(ByVal shaderType As ShaderType, ByVal code As String) Dim shader As Integer = GL.CreateShader(shaderType) GL.ShaderSource(shader, code) GL.CompileShader(shader) Dim status As Integer GL.GetShader(shader, ShaderParameter.CompileStatus, status) If status = False Then MsgBox(GL.GetShaderInfoLog(shader)) End If Return shader End Function Private Function CreateProgram(ByVal shaderList() As Integer) As Integer Dim program As Integer = GL.CreateProgram() For i As Integer = 0 To shaderList.Length - 1 GL.AttachShader(program, shaderList(i)) Next GL.LinkProgram(program) Dim status As Integer GL.GetProgram(program, ProgramParameter.LinkStatus, status) If status = False Then MsgBox(GL.GetProgramInfoLog(program)) End If For i As Integer = 0 To shaderList.Length - 1 GL.DetachShader(program, shaderList(i)) Next Return program End Function

    Read the article

  • VB.Net Dynamically Load DLL

    - by hermiod
    I am trying to write some code that will allow me to dynamically load DLLs into my application, depending on an application setting. The idea is that the database to be accessed is set in the application settings and then this loads the appropriate DLL and assigns it to an instance of an interface for my application to access. This is my code at the moment: Dim SQLDataSource As ICRDataLayer Dim ass As Assembly = Assembly. _ LoadFrom("M:\MyProgs\WebService\DynamicAssemblyLoading\SQLServer\bin\Debug\SQLServer.dll") Dim obj As Object = ass.CreateInstance(GetType(ICRDataLayer).ToString, True) SQLDataSource = DirectCast(obj, ICRDataLayer) MsgBox(SQLDataSource.ModuleName & vbNewLine & SQLDataSource.ModuleDescription) I have my interface (ICRDataLayer) and the SQLServer.dll contains an implementation of this interface. I just want to load the assembly and assign it to the SQLDataSource object. The above code just doesn't work. There are no exceptions thrown, even the Msgbox doesn't appear. I would've expected at least the messagebox appearing with nothing in it, but even this doesn't happen! Is there a way to determine if the loaded assembly implements a specific interface. I tried the below but this also doesn't seem to do anything! For Each loadedType As Type In ass.GetTypes If GetType(ICRDataLayer).IsAssignableFrom(loadedType) Then Dim obj1 As Object = ass.CreateInstance(GetType(ICRDataLayer).ToString, True) SQLDataSource = DirectCast(obj1, ICRDataLayer) End If Next EDIT: New code from Vlad's examples: Module CRDataLayerFactory Sub New() End Sub ' class name is a contract, ' should be the same for all plugins Private Function Create() As ICRDataLayer Return New SQLServer() End Function End Module Above is Module in each DLL, converted from Vlad's C# example. Below is my code to bring in the DLL: Dim SQLDataSource As ICRDataLayer Dim ass As Assembly = Assembly. _ LoadFrom("M:\MyProgs\WebService\DynamicAssemblyLoading\SQLServer\bin\Debug\SQLServer.dll") Dim factory As Object = ass.CreateInstance("CRDataLayerFactory", True) Dim t As Type = factory.GetType Dim method As MethodInfo = t.GetMethod("Create") Dim obj As Object = method.Invoke(factory, Nothing) SQLDataSource = DirectCast(obj, ICRDataLayer) EDIT: Implementation based on Paul Kohler's code Dim file As String For Each file In Directory.GetFiles(baseDir, searchPattern, SearchOption.TopDirectoryOnly) Dim assemblyType As System.Type For Each assemblyType In Assembly.LoadFrom(file).GetTypes Dim s As System.Type() = assemblyType.GetInterfaces For Each ty As System.Type In s If ty.Name.Contains("ICRDataLayer") Then MsgBox(ty.Name) plugin = DirectCast(Activator.CreateInstance(assemblyType), ICRDataLayer) MessageBox.Show(plugin.ModuleName) End If Next I get the following error with this code: Unable to cast object of type 'SQLServer.CRDataSource.SQLServer' to type 'DynamicAssemblyLoading.ICRDataLayer'. The actual DLL is in a different project called SQLServer in the same solution as my implementation code. CRDataSource is a namespace and SQLServer is the actual class name of the DLL. The SQLServer class implements ICRDataLayer, so I don't understand why it wouldn't be able to cast it. Is the naming significant here, I wouldn't have thought it would be.

    Read the article

  • Convert VB6 to C# use NDDE ? help

    - by tabvn
    i have a vb6 code i want to use http://ndde.codeplex.com/ , please help me convert to c# thanks Const TOPIC_SENSOR As String = "SeeLane|Sensor" Const TOPIC_GATE As String = "SeeLane|Gate" Const TOPIC_PIN As String = "SeeLane|Pin" Const ITEM_SENSOR_ACTIVATE As String = "Activate" Const ITEM_GATE_OPEN As String = "Open" Const ITEM_PIN_ON As String = "On" Const ITEM_PIN_OFF As String = "Off" Private Sub Form_Load() On Error GoTo NO_DDE_SERVER lblCar.LinkMode = vbLinkNotify lblLaneId.LinkMode = vbLinkManual lblName.LinkMode = vbLinkManual lblAuthorized.LinkMode = vbLinkManual lblFile.LinkMode = vbLinkManual lblConfidence.LinkMode = vbLinkManual lblType.LinkMode = vbLinkManual MsgBox "Ket noi voi thanh cong voi SeeLane !!!" Exit Sub NO_DDE_SERVER: MsgBox "Khong the ket noi voi SeeLane !(Xem chuong trinh co chay khong?)." Exit Sub End Sub Private Sub lblCar_LinkNotify() On Error Resume Next lblCar.LinkRequest lblLaneId.LinkRequest lblName.LinkRequest lblAuthorized.LinkRequest lblFile.LinkRequest lblConfidence.LinkRequest lblType.LinkRequest CheckAuthorized lblLaneId.Caption = lblLaneId.Caption + 1 End Sub Private Sub CheckAuthorized() Dim i As Integer i = lblAuthorized.Caption i = i + 1 If lblAuthorized.Caption = 1 Then lblPoke.LinkTopic = TOPIC_GATE lblPoke.LinkItem = ITEM_GATE_OPEN lblPoke = Chr(lblLaneId.Caption) lblPoke.LinkMode = vbLinkManual lblPoke.LinkPoke End If End Sub

    Read the article

  • SQL bottleneck, how to fix

    - by masfenix
    This is related to my previous thread: http://stackoverflow.com/questions/3069806/sql-query-takes-about-10-20-minutes However, I kinda figured out the problem. The problem (as described in the previous thread) is not the insert (while its still slow), the problem is looping through the data itself Consider the following code: Dim rs As DAO.Recordset Dim sngStart As Single, sngEnd As Single Dim sngElapsed As Single Set rs = CurrentDb().QueryDefs("select-all").OpenRecordset MsgBox "All records retreived" sngStart = Timer Do While Not rs.EOF rs.MoveNext Loop sngEnd = Timer sngElapsed = Format(sngEnd - sngStart, "Fixed") ' Elapsed time. MsgBox ("The query took " & sngElapsed _ & " seconds to run.") As you can see, this loop does NOTHING. You'd expect it to finish in seconds, however it takes about 857 seconds to run (or 15 minutes). I dont know why it is so slow. Maybe the lotusnotes sql driver? any other ideas? (java based solution, any other solution) What my goal is: To get all the data from remote server and insert into local access table

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11  | Next Page >