473,788 Members | 2,837 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form won't play nice with rtb

I have a VB.NET program called "Calendar" that has a menu on the top that
opens up another form (like a pop-up box) on top of "Calendar". The pop-up
box form is called "Memos" which is a stand-alone (doesn't communicate with
first form) database form with 3 drop-down boxes, a "Close" box and a rtb.
I had this working (see "Saving RTB content to SQL Server" in the
microsoft.publi c.vb.database forum) and then a user started to complain
about application crashes. On investigation I found that I couldn't
recreate the issue reliably but noticed that the problem seemed to occur
when the user typed alot of information into the rtb control. So, I tried
to write error code around the code in my "SaveMessag e" procedure, but the
funny thing is that the code doesn't error when it actually tries to save
the data (which I am doing in a referenced object I built), or when it goes
through the code to put the data in the rtb. If I step through the code
(without the error trapping) it makes it all the way to what I would expect
to be the end, and then I hit F8 at the last "Sub End" line thinking the
next thing I will see is the "Memos" form and instead I get an "unhandled
exception of type 'System.NullRef erenceException '... Object reference not
set to an instance of an object." error and the line it is stopping on is
"Public Class Calendar" from the "Calendar" form!!! I can still see my
"Memos" form in the fore-ground and that is the form it should have dropped
me to.

I came up with the idea of having thedatabase object return a "1" or "0"
depending on whether the data saved to the database correctly, and that
seems to return the "0" when I put in the long string into the rtb, but even
if I insert code to deal with the error condition, I still get the "Object
reference" error at the end just like before.

All I can think of is that this has something to do with the rtb not dealing
with the data properly and somehow destroying the actual rtb control on the
form. When my code tries to view it or clear it, it is no longer there and
that would explain the message. It would also explain my database object
returning a "0" properly in this instance. I had the field in SQL Server
set to "binary 1000" and expanded that to 2000, but no effect.

I hope that is enough info for you to go on. There are so many little
things here I almost need to send you the code. Look below for code
snippets of how I am performing certain tasks.

I hope you can help me.

Schoo
Here is how I call "Memos" from "Calendar": =============== ==
Private Sub MenuItem4_Click (ByVal....) Handles MenuItem4.Click
Dim memos as memos = New Memos
memos.show()
End Sub
=============== ==
Here is the call to the database object: =============== ==
Dim response as integer = oDBAccess.saveM essage(strCurMo nth, strCurYear,
strCurType, rtb1)
=============== ==
Here is the active code in the saveMessage function in the database object:

=============== ==
Try
If GetRecsScalar(" select count(*) from monthlymessages where
dtYear = " & dtYear & " and dtMonth = " & dtMonth & " and typeid=(select id
from type where type = '" & type & "')") > 0 Then
strSql = "update monthlymessages set message = @mess where
dtYear = " & dtYear & " and dtMonth = " & dtMonth & " and typeid=(select id
from type where type = '" & type & "')"
Else
strSql = "insert into monthlymessages select " & dtYear & ",
" & dtMonth & ", (select id from type where type = '" & type & "'), @mess"
End If

Dim rtf(999) As Byte
Dim s As New MemoryStream(rt f)
rtb.SaveFile(s, RichTextBoxStre amType.RichText )
Dim p(1) As SqlParameter
p(0) = New SqlParameter("@ mess", SqlDbType.Binar y, 1000)
p(0).Value = rtf

Microsoft.Appli cationBlocks.Da ta.SqlHelper.Ex ecuteNonQuery(o Settings.dbConn ,
CommandType.Tex t, strSql, p)
Catch
intResponse = 0
End Try
Return intResponse
=============== ==

Nov 21 '05 #1
0 752

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
3000
by: Pete | last post by:
I have form/select which executes a function using onchange. No problem. However, when I validate the page with a strict HTML 4.01 doctype at http://validator.w3.org, it demands either an action or a method for the form?. If I give it an empty action <form action="" ..... it validates OK. Is this acceptable or is there a better/standards correct way? Thanks.
5
8332
by: javaguy | last post by:
I have a data entry web application that is formatted heavily with tables. Having learned a bit of CSS, I'm hoping to rewrite this using <div> tags. But I have run into a formatting problem that keeps me from a solution. I'm hoping for some trick. Assume that "label_a" is a <label> tag and "INPUT_A" is an <input> tag. A sample of my current web page is: <table> <tr><td>label_a</td><td>INPUT_A</td>
1
1299
by: cbell | last post by:
I would like javascript file (which can be a .js file) which I can use to play .wav files on demand. there are many pages and there will only be ONE .wav file (about 20 seconds) for each page. the form table to go onto the page will have graphics (not form buttons) for: - play/pause - stop - volume >> I will design the buttons later, the form doesn't have to be fancy - it just has to work with graphic buttons.
4
2316
by: Mason | last post by:
This is probably an incredibly newbie-ish question. I just haven't had the cause to use many subforms before, so I'm pretty sure I just don't understand it correctly (even after reading up on it). I have a relationship set up that is used to track the hours an employee has worked on each project during the week. I'm trying to set up a Form to allow someone to choose their name and a Period Ending date (basically, the tblTimeReport...
0
848
by: scorpion53061 | last post by:
I built a vb.net windows app for our customers that utilize our services. This app uses Port 23(telnet) to communicate data to/from the user for order entry and stock status as this form of communication works with my AIX Server. I also use SQL Server to record information of what the customer is looking for (by the way the customers knows this and are ok with it - it is in the agreement on which they agree to use the software. Often...
13
1333
by: Schoo | last post by:
I have a VB.NET program called "Calendar" that has a menu on the top that opens up another form (like a pop-up box) on top of "Calendar". The pop-up box form is called "Memos" which is a stand-alone (doesn't communicate with first form) database form with 3 drop-down boxes, a "Close" box and a rtb. I had this working (see "Saving RTB content to SQL Server" in the microsoft.public.vb.database forum) and then a user started to complain...
1
1142
by: Carl Wenrich | last post by:
I installed python 2.4.4 from source. When I try to run the demo tkinter (hello.py) script, I get a message saying my python may not be configured for Tk.
132
299155
by: alienmojo | last post by:
Both youtube and Limewire won't work for me anymore and I don't know why. I downloaded both recent Java and Flash downloads. What can the problem be?
4
1600
by: MyCaymanCondo | last post by:
I checked my www.MyCaymanCondo.ky site (which is fine in IE) in Firefox and at first it looked horrific with most content totally missing. I'm working first on sorting out the home page. I've managed to deal with the Nested Div's problem to some extent so I'm almost there - but no matter what I do can I get FireFox to show the page content with the White background that I've got in the maincontainer div.... Can anyone help out here?! ...
2
8184
by: shannona | last post by:
I've been banging my head against an interaction between a table and float element. I want the two of them to together take up 100% of the width of their container. If the table cells' content were to wrap around the float, even better, but that's not necessary. However, I'm continuously running into two issues: 1.) If I make my table 100%, it writes over the float: right for tables where the content text is long enough. 2.) If I...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.