It's easier to learn to use a gun then a knife. Get proper training and you shouldn't have to worry about the bandit getting yor gun.
I teach a women's firearm safety and self defense class.
Notice I said "self defense" and not "shooting" class. It's rather I conventuals we deal with what occurred in the real world, an couple examples; I use a rather large rag doll. The lady has it by the hand and has to pull the doll behind her to protect it while she engages the target.
Another and more on topic is the shoulder stap of a purse is attached to the target stand and the lady has to engage the target while pulling the purse AND protecting the handgun.
I use several similar scanarios but you get the idea... I don't do knives, I stress having the pistol/revolver on your person or with in reach 24/7.
CPT USAR Ret
USAMU Sniper School Oct '78
Distinguished Rifle Badge 1071