A new post following the previous post for CREATING the code for the buttons
 

1)  To write the code we first save the GUI  by < initial page . fig>  where  initial page is file name  and .fig indicate the extension for it.

2) To write we click the button right  to get the  view callback  where we can we have different sub-parts for creation the the function on that button .

3)  We select the callback for writing the code.

4) here is the code for the particular button that is detail which i posted in previous post GUI.


           code for the button detail

where we see detail button is called as the pushbutton_2 .

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

str = get(handles.edit1,'string');
if ( str ~= 0)
    
        
     str2 = get(handles.edit11,'string');

            if ( str2 ~= 0)

s=oledbcnstr('Access',[],[cd '\proj.mdb']);

cn=oledbcn(s);
str = get(handles.edit1,'String');

bal=get(handles.edit9,'String');
amount2=get(handles.edit11,'String');
bal = str2double(bal);
amount2 = str2double(amount2);
rem2 = bal +amount2;
 
  sql=['update newaccount  set balance = ',num2str(rem2),' where  accno = ', str];
  set(handles.edit9,'String',num2str(rem2));
%Run query and return results
x=oledbquery(cn,sql);

msgbox('Database Updated with new amount','DataBase Info','help');
            else
                msgbox('Please Enter the Amount To Deposit','State Bank Of India','help')

            end
       
else
    msgbox('Please Enter the Account Number','State Bank Of India','help');
end

next code for next button will be soon bought to you. As i discover more for it .


Comments

Popular Posts